How to get the participant id when auth-services is configured?

Question: If I have an up-and-running participant node with auth-services configured, how do I get the participant id?


Without auth-services configured, I can get the participant id like this:

> grpcurl -plaintext localhost:5005 \
  com.daml.ledger.api.v1.admin.PartyManagementService/GetParticipantId \
  | jq -r '.participant_id'

participant2::1220d182f96742328a7627d18b032af9cd17f1e0a09391fd9a4ecb5bcaa50821f987

With auth-services configured, I need a token to call that endpoint:

> grpcurl -plaintext localhost:5003 \
  com.daml.ledger.api.v1.admin.PartyManagementService/GetParticipantId \
  | jq -r '.participant_id'

ERROR:
  Code: Unauthenticated

But, to create the ~chicken~ token I need the ~egg~ participant id.

The following, added to the node’s bootstrap script, writes the participant id to a file:

import java.nio.file.{Paths, Files}
import java.nio.charset.StandardCharsets

Files.write(
  Paths.get("/canton/host/configs/participant1.id"),
  participant1.id.toProtoPrimitive
    .substring(5)
    .getBytes(StandardCharsets.UTF_8)
)

Am I overlooking something simpler?

I find that the participant id can also be found in the logs.

For example:

INFO  c.d.c.p.s.b.c.ParameterStorageBackendImpl$:
participant=participant1 -
Initializing new database for ledgerId 'participant1' and participantId 
'participant1::1220dd728fe4293ff821108301b205dddc95d80bc6965e58b7fdb2a71de8d2b2a9b9'