# Auth0 API tokens: find, store, rotate, and use them safely with AI agents

Source: https://botpassword.com/keys/auth0
Last checked: 2026-10-25

Auth0 Management API access tokens last 24 hours by default and cannot be revoked once issued, so keep lifetimes short. The long-lived secret is the application's client secret, which you can rotate in the Dashboard or through the Management API.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| Management API access token | — | Yes | The scopes granted per endpoint; audience `https://{yourDomain}/api/v2/` | 86,400 seconds (24 hours) by default, configurable per API |
| Application client secret | — | Yes | Lets the application request tokens | — |

## How to create a Auth0 key

1. Find the endpoint's required scopes in the Management API Explorer.
2. Obtain a token with those scopes for the audience `https://{yourDomain}/api/v2/`.

## Limiting what the key can do

Each Management API endpoint needs specific scopes; check the Management API Explorer. Grant only those scopes to the application.

## How to rotate a Auth0 key

1. Rotate the application's client secret in the Dashboard or through the Management API.
2. Update every service using the old secret.

## How to revoke a Auth0 key

1. Access tokens cannot be revoked once issued. Refresh tokens can be revoked in the Dashboard, the Authentication API or the Management API.

## If the key leaked

1. Rotate the client secret.
2. Shorten the Management API token lifetime.
3. Revoke any refresh tokens that may be affected.

## Environment variables

- `AUTH0_DOMAIN`
- `AUTH0_CLIENT_ID`
- `AUTH0_CLIENT_SECRET`

## Gotchas

- Issued access tokens cannot be revoked, so the 24-hour default is a leak window.
- Tokens for custom audiences count toward your quota and Management API rate limits.

## Using this key with AI agents (BotPassword)

- `run_with`: Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output.
- `http_request`: Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused.
- `cli_login`: Lets git, Docker, the AWS CLI and kubectl log in through bpw's credential helper, so the token is fetched when the tool needs it and not written into its config. The helper hands the value to the tool, so the grant is always disclosing. Other tools use run_with; OAuth device logins are planned.
- `rotate`: Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet.

## FAQ

### How long does an Auth0 Management API token last?

24 hours by default, and you can change it per API.

### Can I revoke an Auth0 access token?

No. Keep lifetimes short; only refresh tokens can be revoked.

### How do I log the Auth0 CLI in without a browser?

Use client credentials with `auth0 login --domain --client-id --client-secret`.

### Can an AI agent use my Auth0 key without seeing it?

Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a `.env` file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with `run_with`, `http_request`, so the agent gets the result and never the value.

## Sources

- https://auth0.com/docs/secure/tokens/access-tokens/management-api-access-tokens
- https://auth0.github.io/auth0-cli/auth0_login.html
- https://auth0.com/docs/get-started/auth0-mcp-server
