Generate Access Token
Generates an OAuth 2.0 access token using client credentials. This token must be included as a Bearer token in the Authorization header for all subsequent API calls.
grant_typewill always remainclient_credentials.client_idandclient_secretcan be obtained from your Auth0 account.audiencewill vary based on the target environment.
Once this endpoint is configured with the correct credentials, you will be able to successfully retrieve the access token.
Client credentials required to generate an access token.
- Type: stringaudiencerequired
The target API audience URL. This value varies based on the environment (e.g., staging, production).
- Type: stringclient
_id requiredThe unique client identifier assigned to your application in Auth0. Available from your Auth0 account.
- Type: stringclient
_secret requiredThe secret key associated with your client ID in Auth0. Available from your Auth0 account. Keep this value confidential.
- Type: stringgrant
_type requiredThe OAuth 2.0 grant type. Must always be
client_credentialsfor machine-to-machine authentication.
- application/json
- application/json
- application/json
curl https://SERVER_NAME_GOES_HERE.auth0.com/oauth/token \
--request POST \
--header 'Content-Type: application/json' \
--data '{
"grant_type": "client_credentials",
"client_id": "CLIENT_GOES_HERE",
"client_secret": "CLIENT_SECRET_GOES_HERE",
"audience": "AUDIENCE_GOES_HERE"
}'
{
"access_token": "ACCESS_TOKEN_GOES_HERE",
"scope": "readwrite:gc",
"expires_in": 3600,
"token_type": "Bearer"
}