json2html service returns Unauthorized error in AEM Cloud Sites

In Adobe Experience Manager Cloud Sites, the json2html service returns an Unauthorized error when a POST request is sent during content overlay configuration. This issue occurs even when the initial overlay configuration succeeds and the user has administrative access. To fix this issue, verify and use a valid authentication token when sending the POST request to the json2html service.

Description description

Environment

Adobe Experience Manager (AEM) Cloud Sites (all versions)

Symptoms

When configuring content overlay as described in the product documentation, the POST request to the json2html service returns an Unauthorized error.

  • Step 1 (initial overlay configuration) completes successfully.
  • The error occurs in Step 2, when sending the POST request to configure the overlay.
  • The user has admin permissions and is using the expected authentication token.

Example cURL command:

curl --request POST \
  --url "https://json2html.adobeaem.workers.dev/config///main" \
  --header "Authorization: token <token>" \
  --header "Content-Type: application/json" \
  --data '[  ... ] '

The response is: Unauthorized

Cause

The Unauthorized error occurs when the authentication token used in the POST request is missing, expired, or invalid.

Resolution resolution

  1. Generate a new admin API authentication token:

    1. Go to the admin login page for your environment.
    2. Log in with your admin credentials.
    3. After logging in, copy the authToken value provided.
  2. Update your service configuration with the new token. Use the copied authToken as the value for the Authorization header in your POST request to the json2html service.

  3. Retry the POST request. Resend the POST request with the updated token and verify that the request completes successfully without the ‘Unauthorized’ error.

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