AEM Helix: Correct usage of Admin API token for JSON2HTML configuration

This article explains how to obtain and use the correct Admin API token for authenticating JSON2HTMLconfiguration requests in Adobe Experience Manager (AEM) Helix environments.

Description description

Environment

Adobe Experience Manager (AEM) Helix (all versions)

Issue/Symptoms

Attempts to configure JSON2HTML via the API endpoint (for example, https://json2html.adobeaem.workers.dev/config/<ORG>/<SITE>/<BRANCH>) result in a 401 Unauthorized error. Authentication fails when the request doesn’t use the required authentication format.

HTTP/1.1 401 Unauthorized

The request was sent with an incorrect header or token format.

Resolution resolution

Follow these steps to resolve:

  1. Go to https://admin.hlx.page/login and authenticate with your credentials.

  2. After logging in, open https://admin.hlx.page/profile.

  3. In your browser developer tools, navigate to the cookies for admin.hlx.page.

  4. Copy the value of the auth_token cookie.

  5. Format the authorization header:

    • Header name: Authorization
    • Header value: token <auth_token> (replace <auth_token> with the cookie value)

Example cURL command:

curl -i -X POST \
    "https://json2html.adobeaem.workers.dev/config/<ORG>/<SITE>/<BRANCH>" \
    -H "Authorization: token <auth_token_from_cookie>" \
    -H "Content-Type: application/json" \
    --data '[  ... ] '

A successful request returns HTTP/1.1 200 OK and the configuration is accepted.

recommendation-more-help
experience-cloud-kcs-help-kbarticles