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_type will always remain client_credentials.
  • client_id and client_secret can be obtained from your Auth0 account.
  • audience will 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.

Body
required
application/json

Client credentials required to generate an access token.

  • audience
    Type: string
    required

    The target API audience URL. This value varies based on the environment (e.g., staging, production).

  • client_id
    Type: string
    required

    The unique client identifier assigned to your application in Auth0. Available from your Auth0 account.

  • client_secret
    Type: string
    required

    The secret key associated with your client ID in Auth0. Available from your Auth0 account. Keep this value confidential.

  • grant_type
    Type: string
    required

    The OAuth 2.0 grant type. Must always be client_credentials for machine-to-machine authentication.

Responses
  • application/json
  • application/json
  • application/json
Request Example for post/oauth/token
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"
}