IMS access token does not work across multiple Adobe Commerce environments

IMS access tokens generated using OAuth server-to-server credentials work successfully in one Adobe Commerce environment but fail with a 401 Unauthorized error in another. This behavior occurs because each Commerce environment requires its own IMS configuration and explicit permissions for the technical account associated with the token. To fix this, configure IMS integration per environment, create separate OAuth credentials, and assign the required Admin permissions to the technical account in each Commerce instance.

Description description

Environment

  • Product: Adobe Commerce Cloud
  • Version: 2.4.7
  • Authentication type: OAuth server-to-server with IMS integration

Issue/Symptoms

  • An IMS access token works for REST API calls in one Commerce environment, such as production.
  • The same token fails with a 401 Unauthorized error in another environment, such as staging or QA.
  • The REST API response includes the error message: The consumer isn’t authorized to access %resources.

Resolution resolution

Follow these steps to fix the issue:

  1. Enable and configure Adobe IMS integration in each Commerce environment where REST API access is required.
  2. Create separate OAuth server-to-server credentials for each environment in the Adobe Developer Console. For detailed guidance on setting up environment-specific OAuth server-to-server credentials and generating IMS access tokens, see the Server-to-server Authentication.
  3. Generate an IMS access token using the client ID and client secret specific to that environment.
  4. Add the technical account associated with the IMS token as an Admin user in the Commerce Admin for that environment.
  5. Assign the required Admin role and permissions to the technical account.
  6. Use the correct IMS access token when making REST API calls to each environment endpoint.
  7. Confirm that REST API requests complete successfully without a 401 Unauthorized error.
recommendation-more-help
3d58f420-19b5-47a0-a122-5c9dab55ec7f