Generate an Auth0 Machine-to-Machine Token With a Custom Domain Issuer
Last Updated:
Overview
Obtaining a Machine-to-Machine (M2M) access token with a custom domain as the issuer requires modifying the generated code from the Auth0 Dashboard API Test page to use the custom domain URL. Administrators often need the Auth0 Dashboard API Test page to use a custom domain instead of the canonical domain when generating test tokens.
Applies To
- Auth0
- Custom Domains
- Machine-to-Machine (M2M) Tokens
- Auth0 Dashboard API Test Page
Solution
What steps generate an Auth0 Machine-to-Machine token with a custom domain issuer?
Generate the token using Postman or cURL by modifying the sample code provided by the Auth0 Dashboard.
- Go to the API Test page in the Auth0 Dashboard and copy the generated cURL or Node/Python code.
- Paste the code into a terminal or import it into Postman.
- Replace the canonical domain URL (for example,
https://<tenant>.region.auth0.com/oauth/token) with the custom domain URL (for example,https://api.<custom_domain>.com/oauth/token). - Execute the request.
Because the terminal or Postman sends the Client Credentials grant request directly to the custom domain's /oauth/token endpoint, Auth0 issues the token with the custom domain as the iss (issuer) claim.