---
title: "Generate a JSON Web Token (JWT)"
slug: "generate-a-json-web-token--jwt-"
abstract: "How to request an access token."
---
# Generate a JSON Web Token (JWT)

> [!note]
> To configure Content Hub, you must either be a superuser or have the necessary permissions granted to you through [user group policies](https://doc.sitecore.com/ch/en/users/content-hub/user-group-policies.html).

Sitecore Experience Edge uses the [OAuth authorization framework](https://auth0.com/docs/authorization/protocols/protocol-oauth2) for security. OAuth allows one program to authorize another program to make changes on behalf of an account holder or end-user.

To execute an operation in the Experience Edge APIs, the calling system must first obtain an authentication token (in JWT format) and include it in every request. Following successful authentication, the calling application has access to an access token used to call the protected APIs.

## Retrieve credentials

To retrieve credentials:

1. In Content Hub, click **Manage** :mdiCogOutline:.

2. On the **Manage** page, click **Settings**.

3. On the **Settings** page, in the **Search** box, type *PublishingSettings*, and select it.

4. Click **Delivery API data** to open a dialog with the following parameters:
 
   | Parameter      | Description |
   | -------------- | ----------- |
   | Delivery URL   | The GraphQL endpoint URL. This is not used when generating tokens. |
   | Authority&nbsp;URL  | The endpoint URL base appended to POST calls (for example, if the Authority URL is `https://auth.sitecore.io`, the complete endpoint is `https://auth.sitecore.io/oauth/token`). |
   | OAuth audience | The `audience` parameter is used in the [request](https://doc.sitecore.com/ch/en/developers/cloud-dev/generate-a-json-web-token-jwt.html#request) body (for example, `https://<audience>/<tenant_id>`).|
   | Client ID      | The unique client identifier for your tenant. The `client_id` parameter is used in the [request](https://doc.sitecore.com/ch/en/developers/cloud-dev/generate-a-json-web-token-jwt.html#request) body.|
   | Client secret  | The client secret for your tenant. The `client_secret` parameter is used in the request body. |

5. Set `grant_type` to `client_credentials`. 

> [!note]
> CaaS must be properly configured on the tenant to see Delivery API data.

> [!tip]
> Click **Copy** :mdiContentCopy: to copy the details to the clipboard. Click :mdiEyeOutline: to see the client secret.

## Request

To request an access token, you use a POST request. Using `curl`, the access-token request has the following form:

```HTTP
curl --request POST --url "<AUTH_URL>/oauth/token" --header "content-type: application/x-www-form-urlencoded" --data grant_type=client_credentials --data client_id=<CLIENT_ID> --data client_secret=<CLIENT_SECRET> --data audience=https://<AUDIENCE_DOMAIN>/<TENANT_ID>

```

## Response

In response to the request, you receive the `access_token`, `token_type`, and `expires_in values`. You can pass the retrieved access token as a Bearer token in the [authorization header](https://doc.sitecore.com/ch/en/developers/cloud-dev/experience-edge-admin-api.html "Experience Edge Admin API") of your HTTP requests.

> [!important]
> The period after which JWTs expire is defined by the `expires\_in` property. This is typically set to 24 hours. When one of these tokens expires, it is no longer valid and a new one must be requested.