In certain cases, you may want to use Auth0’s Management API to manage your applications and APIs rather than the Auth0 Management Dashboard. To call any endpoints, you must authenticate using a specialized Access Token called the Management API Token. Management API Tokens are JSON Web Tokens (JWTs) that contain specific granted permissions (also known as scopes) for the Management API endpoints you want to call.

Limitations

Since single-page applications (SPAs) are and cannot securely store sensitive information (such as a ), they must retrieve Management API Tokens from the frontend, unlike other application types. This means that Management API Tokens for SPAs have certain limitations. Specifically, they are issued in the context of the user who is currently signed in to Auth0 which limits updates to only the logged-in user’s data. Although this restricts use of the Management API, it can still be used to perform actions related to updating the logged-in user’s user profile.
Auth0 does not recommend putting Management API Tokens on the frontend that allow users to change user metadata. This can allow users to manipulate their own metadata in a way that could be detrimental to the functioning of the applications. It also allows a customer to do a DoS attack against someone’s management API by just spamming it and hitting rate limits.

Available scopes and endpoints

With a Management API Token issued for a SPA, you can access the following scopes (and hence endpoints).
Password changes through the PATCH /api/v2/users/ endpoint are not possible with a Management API Token issued for a SPA.
Scope for Current UserEndpoint
read:current_userGET /api/v2/users/
GET /api/v2/users//enrollments
update:current_user_identitiesPOST/api/v2/users//identities
DELETE /api/v2/users//identities//
update:current_user_metadataPATCH /api/v2/users/
create:current_user_metadataPATCH /api/v2/users/
create:current_user_device_credentialsPOST /api/v2/device-credentials
delete:current_user_device_credentialsDELETE /api/v2/device-credentials/
The above scopes and endpoints are subject to rate limits.

Use Management API token to call Management API from a SPA

You can retrieve a Management API Token from a SPA (using the Management API’s to generate it) and use the token to call the Management API to retrieve the full user profile of the currently logged-in user.
  1. Retrieve a Management API token.
    1. Authenticate the user by redirecting them to the Authorization endpoint, which is where users are directed upon login or sign-up.
    2. When you receive the Management API Token, it will be in JSON Web Token format.
    3. Decode it and review its contents.
  2. Call the Management API to retrieve the logged-in user’s user profile from the Get User by ID endpoint.
    1. To call the endpoint, include the encoded Management API token you retrieved in the Authorization header of the request.
    2. Be sure to replace the USER_ID and MGMT_API_ACCESS_TOKEN placeholder values with the logged-in user’s user ID (sub value from the decoded Management API token) and the Management API access token, respectively.

Learn more