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'


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'

  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


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