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

# Get Token

> Exchange an Authorization Code for a token as the final step of the Authorization Code Flow with PKCE.

## Endpoint

`POST /oauth/token`

This is the flow that mobile apps use to access an API. Use this endpoint to exchange an Authorization Code for a token.

### Remarks

* In order to improve compatibility for applications, Auth0 will now return profile information in a structured claim format as defined by the OIDC specification. This means that in order to add custom claims to ID tokens or access tokens, they must conform to a namespaced format to avoid possible collisions with standard OIDC claims.
* Include `offline_access` to the `scope` request parameter to get a refresh token from POST /oauth/token. Make sure that the Allow Offline Access field is enabled in the API Settings.
* The `redirect_uri` value must be specified as a valid callback URL under your Application's Settings.
* Silent authentication lets you perform an authentication flow where Auth0 will only reply with redirects, and never with a login page. When an Access Token has expired, silent authentication can be used to retrieve a new one without user interaction, assuming the user's Single Sign-on (SSO) session has not expired.

### Learn More

* [Authorization Code Flow with Proof Key for Code Exchange (PKCE)](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce)
* [Call API Using the Authorization Code Flow with PKCE](https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow-with-pkce/call-your-api-using-the-authorization-code-flow-with-pkce)
* [Silent Authentication](https://auth0.com/docs/authenticate/login/configure-silent-authentication)

## Headers

**DPoP** `string`

A DPoP proof for the request. This is optional and only required if your application uses Demonstrating Proof-of-Possession.

## Body Parameters

The request body is in `application/x-www-form-urlencoded` format.

**grant\_type** `string` *required*

Denotes the flow you are using. For Authorization Code (PKCE) use `authorization_code`.

Allowed values: `authorization_code`

**client\_id** `string` *required*

Your application's Client ID.

**client\_secret** `string`

The `client_secret` of your application. Required for confidential applications using the `client_secret_post` token endpoint authentication method.

**code** `string` *required*

The Authorization Code received from the initial `/authorize` call.

**code\_verifier** `string` *required*

Cryptographically random key that was used to generate the `code_challenge` passed to `/authorize`.

**redirect\_uri** `string`

This is required only if it was set at the `GET` `/authorize` endpoint.

## Response Schema

200

\{}

application/json

**access\_token** `string`

The access token.

**refresh\_token** `string`

The refresh token used to obtain new access tokens.

**id\_token** `string`

The ID token.

**token\_type** `string`

The type of token. Usually `Bearer`.

**expires\_in** `integer`

The access token lifetime in seconds.

default

\{}

application/json

**error** `string`

Error code.

**error\_description** `string`

Error description.

## Response Messages

| Status | Description |
| - | - |
| 200 | Successful token exchange. |
| default | Unexpected error |
