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:
-
Upgrade the AEM Events add-on in your codebase. In your Maven build, update the
aio-aem-events(and underlyingaio-lib-java) dependency to version 2.0.4 or higher to ensure OAuth Server-to-Server support. -
Update OSGi Configuration to Use OAuth:
-
Locate the OSGi configuration for PID:
com.adobe.aio.aem.workspace.internal.WorkspaceSupplierImpl(typically in yourui.configor equivalent). -
Set the property
aio.oauth.scopesto the OAuth Server-to-Server scopes from your Adobe Developer Console credential. -
Remove the following JWT-specific keys from the configuration:
aio.meta.scopesaio.technical.account.idaio.encoded.pkcs8(private key)- Retain
aio.api.keyandaio.client.secret(as a secret environment variable) for your OAuth Server-to-Server client.
-
-
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_scopesand the value matches the OAuth Server-to-Server credential. Do not include quotation marks or placeholders in the value.
- Name:
-
-
Deploy the updated code and configuration via your Cloud Manager pipeline.
-
Verify the integration:
-
After deployment, check the following endpoints on your AEM environment:
/bin/aio/workspace.jsonshould show OAuth scopes present and no JWT metascopes./bin/aio/events/provider.jsonand/bin/aio/events/publish_ping.jsonshould report:status: “up”provider_already_registered:true- No
invalid_clientorexchange_jwterrors. - Publish or unpublish a test page and confirm that events are received by your webhook endpoint.
-