gcloud_auth_application-default_print-access-token (1)
NAME
- gcloud auth application-default print-access-token - print an access token for your current Application Default Credentials
SYNOPSIS
-
gcloud auth application-default print-access-token [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
gcloud auth application-default print-access-token generates and prints an access token for the current Application Default Credential (ADC). The ADC can be specified either by setting the GOOGLE_APPLICATION_CREDENTIALS environment variable to the path of a service account key file (JSON) or using gcloud auth application-default login.
The access token generated by gcloud auth application-default print-access-token is useful for manually testing APIs via curl or similar tools.
In order to print details of the access token, such as the associated account and the token's expiration time in seconds, run:
- $ curl www.googleapis.com/oauth2/v1/tokeninfo?access_token= $(gcloud auth application-default print-access-token)
This command should be used sparingly and for debugging alone.
GCLOUD WIDE FLAGS
These flags are available to all commands: --account, --configuration, --flags-file, --flatten, --format, --help, --log-http, --project, --quiet, --trace-token, --user-output-enabled, --verbosity. Run $ gcloud help for details.
NOTES
This variant is also available:
- $ gcloud beta auth application-default print-access-token