> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Access Tokens

> Learn how to request Access Tokens using the Authorize endpoint when authenticating users and include the target audience and scope of access requested by the app and granted by the user.

To access your API, you must request an [access token](/docs/docs/secure/tokens/access-tokens) when authenticating a user.

These Auth0 tools help you modify your application to authenticate users:

* [Quickstarts](/docs/docs/quickstarts) are the easiest way to implement authentication. They show you how to use [Universal Login](/docs/docs/authenticate/login/auth0-universal-login/universal-login-vs-classic-login) and Auth0's language- and framework-specific SDKs.
* The [Auth0 Authentication API](/docs/docs/api/authentication) is a reference for those who prefer to write code independently. First, identify [which flow to use](/docs/docs/get-started/authentication-and-authorization-flow/which-oauth-2-0-flow-should-i-use). Then follow the instructions to implement that flow.

To request an access token (Access Token: Authorization credential, in the form of an opaque string or JWT, used to access an API.), make a POST call to the [token URL](/docs/docs/api/authentication#client-credentials-flow).

#### Example POST to token URL

##### Parameters

| Parameter Name | Description |
| - | - |
| `grant_type` | Set this to "client\_credentials". |
| `client_id` | Your application's Client ID. You can find this value on the [application's settings tab](https://manage.auth0.com/#/applications). |
| `client_secret` | Your application's Client Secret. You can find this value on the [application's settings tab](https://manage.auth0.com/#/applications). To learn more about available application authentication methods, read [Application Credentials](/docs/docs/secure/application-credentials). |
| `audience` | The audience for the token, which is your API. You can find this in the **Identifier** field on your [API's settings tab](https://manage.auth0.com/#/apis). |
| `organization` | Optional. The organization name or identifier you want the request to be associated with. To learn more, read [Machine-to-Machine Access for Organizations](/docs/docs/manage-users/organizations/organizations-for-m2m-applications). |

#### Response

You receive an `HTTP 200` response with a payload containing `access_token`, `token_type`, and `expires_in` values:

```json lines theme={null}
{
  "access_token":"eyJz93a...k4laUWw",
  "token_type":"Bearer",
  "expires_in":86400
}
```

> [!WARNING]
>
> Validate your tokens before saving them. To learn how, read [Validate ID Tokens](/docs/docs/secure/tokens/id-tokens/validate-id-tokens) and [Validate Access Tokens](/docs/docs/secure/tokens/access-tokens/validate-access-tokens).

## Control access token audience

When a user authenticates, you request an access token and include the target audience (Audience: Unique identifier of the audience for an issued token. Named aud in a token, its value contains the ID of either an application (Client ID) for an ID Token or an API (API Identifier) for an Access Token.) and scope of access in your request. The application uses the `/authorize` endpoint to request access. This access is both requested by the application and granted by the user during authentication

You can configure your tenant to always include a default audience.

| Token Use | Format | Requested Audience | Requested Scope |
| - | - | - | - |
| /userinfo endpoint | Opaque | tenant name (`\{yourDomain}`), no value for `audience` parameter, no `audience` parameter passed | `openid` |
| Auth0 Management API | JWT | Management API v2 identifier (`https://{tenant}.auth0.com/api/v2/`) | |
| Your own custom API | JWT | The API Identifier for your custom API registered in the Auth0 Dashboard | |

In only one specific instance, access tokens can have multiple target audiences. This requires that your custom API's signing algorithm (Signing Algorithm: Algorithm used to digitally sign tokens to ensure the token has not been tampered with.) is set to **RS256**. To learn more, read [Token Best Practices](/docs/docs/secure/tokens/token-best-practices).

### Multiple audiences

If you specify an audience of your custom API identifier and a scope of `openid`, then the resulting access token's `aud` claim will be an array rather than a string, and the access token will be valid for both your custom API and for the `/userinfo` endpoint. Your access tokens can only have two or more audiences if you use a single custom API as well as Auth0's `/userinfo` endpoint.

### Custom domains and the Auth0 Management API

Auth0 issues tokens with an issuer (`iss)` claim of whichever domain you used when requesting the token. [Custom domain](/docs/docs/customize/custom-domains) users can use either their custom domain (Custom Domain: Third-party domain with a specialized, or vanity, name.) or their Auth0 domain.

For example, suppose you have a custom domain, `https://login.northwind.com`. If you request an access token from `https://login.northwind.com/authorize`, your token's `iss` claim will be `https://login.northwind.com/`. However, if you request an access token from `https://northwind.auth0.com/authorize`, your token's `iss` claim will be `https://northwind.auth0.com/`.

If you request an access token from your custom domain with the target audience of the Auth0 Management API (Management API: A product to allow customers to perform administrative tasks.), then you **must** call the Auth0 Management API from your custom domain. Otherwise your access token is considered invalid.

## Renew access tokens

By default, an access token for a custom API is valid for 86400 seconds (24 hours). You can [shorten the time period before the token expires](/docs/docs/secure/tokens/access-tokens/update-access-token-lifetime).

After an access token has expired, you can renew your access token. To do so either re-authenticate the user using Auth0 or use a [refresh token](/docs/docs/secure/tokens/refresh-tokens).

## Learn more

* [Validate Access Tokens](/docs/docs/secure/tokens/access-tokens/validate-access-tokens)
* [Use Access Tokens](/docs/docs/secure/tokens/access-tokens/use-access-tokens)
* [JSON Web Tokens](/docs/docs/secure/tokens/json-web-tokens)
* [Refresh Tokens](/docs/docs/secure/tokens/refresh-tokens)
* [Identity Provider Access Tokens](/docs/docs/secure/tokens/access-tokens/identity-provider-access-tokens)
* [Management API Access Tokens](/docs/docs/secure/tokens/access-tokens/management-api-access-tokens)
