gcloud_beta_auth_application-default_print-access-token (1)
NAME
- gcloud beta auth application-default print-access-token - print an access token for your current Application Default Credentials
SYNOPSIS
-
gcloud beta auth application-default print-access-token [GCLOUD_WIDE_FLAG ...]
DESCRIPTION
(BETA) Note: Consider using a service account and the complementary gcloud auth activate-service-account to authorize access to Google Cloud
gcloud beta 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 beta 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 command is currently in BETA and may change without notice. This variant is also available:
- $ gcloud auth application-default print-access-token