1. Experience Edge Admin API

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.

Sitecore Experience Edge uses the OAuth authorization framework 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 .

  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:

    ParameterDescription
    Delivery URLThe GraphQL endpoint URL. This is not used when generating tokens.
    Authority URLThe 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 audienceThe audience parameter is used in the request body (for example, https://<audience>/<tenant_id>).
    Client IDThe unique client identifier for your tenant. The client_id parameter is used in the request body.
    Client secretThe 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 to copy the details to the clipboard. Click 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:

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 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.

If you have suggestions for improving this article, let us know!