AEM as a Cloud Service events not triggered with OAuth integration

This article explains how to resolve an issue where Adobe Experience Manager (AEM) as a Cloud Service does not trigger configured events, such as webhooks, when pages are published or unpublished when using OAuth Server-to-Server credentials.

Description description

Environment

  • Adobe Experience Manager (AEM) as a Cloud Service (all versions)
  • AEM Events add-on (aio-aem-events)
  • Integration using OAuth Server-to-Server credentials

Issue/Symptoms

  • Test events sent from the Adobe Developer Console are received by the webhook endpoint.
  • Actual page publish or unpublish actions in AEM do not trigger the event; no webhook requests are received for real content changes.
  • Logs may show errors such as: The client must have the exchange_jwt scope.", error: "invalid_client.
  • OSGi configuration for the AEM Events add-on references legacy JWT fields and lacks the required OAuth scopes.

Cause

The AEM Events add-on is configured to use the deprecated JWT authentication flow, which is not compatible with OAuth Server-to-Server credentials. As a result, real page publish or unpublish events fail to trigger, even though test events work. Additionally, older versions of the add-on do not support OAuth Server-to-Server.

Resolution resolution

To resolve the issue where AEM as a Cloud Service does not trigger configured events, follow these steps:

  1. Upgrade the AEM Events add-on in your codebase. In your Maven build, update the aio-aem-events (and underlying aio-lib-java) dependency to version 2.0.4 or higher to ensure OAuth Server-to-Server support.

  2. Update OSGi Configuration to Use OAuth:

    1. Locate the OSGi configuration for PID: com.adobe.aio.aem.workspace.internal.WorkspaceSupplierImpl (typically in your ui.config or equivalent).

    2. Set the property aio.oauth.scopes to the OAuth Server-to-Server scopes from your Adobe Developer Console credential.

    3. Remove the following JWT-specific keys from the configuration:

      • aio.meta.scopes
      • aio.technical.account.id
      • aio.encoded.pkcs8 (private key)
      • Retain aio.api.key and aio.client.secret (as a secret environment variable) for your OAuth Server-to-Server client.
  3. Configure Cloud Manager environment variable:

    • In Cloud Manager, add or update the environment variable:

      • Name: aio_oauth_scopes
      • Value: Comma-separated OAuth scopes from the Developer Console OAuth Server-to-Server credential
      • Ensure the variable name is exactly aio_oauth_scopes and the value matches the OAuth Server-to-Server credential. Do not include quotation marks or placeholders in the value.
  4. Deploy the updated code and configuration via your Cloud Manager pipeline.

  5. Verify the integration:

    • After deployment, check the following endpoints on your AEM environment:

      • /bin/aio/workspace.json should show OAuth scopes present and no JWT metascopes.
      • /bin/aio/events/provider.json and /bin/aio/events/publish_ping.json should report:
      • status: “up”
      • provider_already_registered: true
      • No invalid_client or exchange_jwt errors.
      • Publish or unpublish a test page and confirm that events are received by your webhook endpoint.
recommendation-more-help
experience-cloud-kcs-help-kbarticles