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
-
Generate a new admin API authentication token:
- Go to the admin login page for your environment.
- Log in with your admin credentials.
- After logging in, copy the
authTokenvalue provided.
-
Update your service configuration with the new token. Use the copied
authTokenas the value for theAuthorizationheader in your POST request to the json2html service. -
Retry the POST request. Resend the POST request with the updated token and verify that the request completes successfully without the ‘Unauthorized’ error.