gcloud auth print-identity-token prints the identity token for the current account. And if you need to use a flag --audiences for the token, replace with the application or service that the token will be used to access, for example [http://www.example.com](http://www.example.com).
There are a few ways to get an ID token:
- Get an ID token from the metadata server.
- Use a connecting service to generate an ID token.
- Generate an ID token by impersonating a service account.
It is not recommended by Google Cloud to generate a valid id_token with a user credential.
You can check below links for your reference.
Service Account Credentials API