User authentication
User Authentication with Adobe's Secure User Sign-In (SUSI) interface enables Commerce administrators to authenticate through Adobe's Identity Management Service (IMS). This authentication flow is specifically designed for scenarios where API operations need to be executed with user-specific permissions. When using this method, all API calls are performed within the context of the authenticated admin user's permissions, as defined in the Adobe Admin Console.
Adobe provides three types of OAuth credentials for User Authentication with a different application architectures:
- OAuth Web App: For applications with a backend server that can securely store client secrets
- OAuth Single Page App (SPA): For browser-based JavaScript applications
- OAuth Native App: For device-native applications (iOS, Android, desktop)
Each credential type has specific security considerations and implementation requirements. For detailed implementation guidance, see the User Authentication Guide.
Prerequisites
Before implementing user authentication, ensure you have:
- An active Adobe Commerce as a Cloud Service license with access to the Admin Console
- Access to Adobe Developer Console for creating OAuth credentials using Adobe Commerce with Adobe ID API
- A configured redirect URI where users will return after authentication
- A secure environment for token handling
Implementation steps
1. Generate IMS credentials
To begin the implementation, you need to obtain IMS client credentials through the Adobe Developer Console. This process involves creating a new project and configuring OAuth authentication specifically for Adobe Commerce with Adobe ID integration.
The Adobe Developer Console provides a straightforward workflow:
Accessing Adobe Developer Console:
- Navigate to Adobe Developer Console.
- Create or select a project that will house your authentication credentials.
- Add the Adobe Commerce with Adobe ID API to your project to enable Commerce-specific authentication.
Creating an OAuth User authentication project:
- Select the preferred OAuth 2 authentication type: Web App/Single-Page App/Native App.
- Configure the allowed redirect URIs.
- Copy the Client ID and Client Secret.
- Make a note of the authorized redirect URIs.
- Securely save your credentials.
2. Authorization flow
Building authorization URL
The authorization URL is used to initiate the authentication process. It includes the client ID, redirect URI, scopes, and a state parameter for security. Here is the example for a web app:
Copied to your clipboardhttps://ims-na1.adobelogin.com/ims/authorize/v2?client_id={{client_id}}&redirect_uri={{redirect_uri}}&scope={{scopes}}&state=something&response_type=code
Replace the following placeholders with your values:
{{client_id}}
: IMS client ID{{redirect_uri}}
: Configured redirect URI{{scopes}}
: Coma-separated list of required scopes:Copied to your clipboardAdobeID,openid,email,profile,additional_info.roles,additional_info.projectedProductContext`
Handling authorization response
- Redirect handling:
- User completes authentication
- Browser redirects to your
redirect_uri
- Authorization code is included in URL parameters
- Authorization code extraction:
- Parse code from URL:
?code={{auth_code}}&state=something
- Verify state parameter matches original request
- Parse code from URL:
- Error handling:
- Check for error parameters in redirect
- Implement appropriate error messaging
- Provide retry mechanisms
3. Token exchange
- Authorization code to access token:
- Make a
POST
request to the token endpoint.
- Make a
Copied to your clipboardPOST https://ims-na1.adobelogin.com/ims/token/v3Authorization: Basic {{base64(client_id:client_secret)}}Content-Type: application/x-www-form-urlencodedcode={{auth_code}}&grant_type=authorization_code
Copied to your clipboard{"access_token": "{ACCESS_TOKEN}","refresh_token": "{REFRESH_TOKEN}","sub": "A0BC123D4CD449CA0A494133@a12b34cd5b5b7e0e0a494004","id_token": "{ID_TOKEN}","token_type": "bearer","expires_in": 86399}
- Token refresh process:
- Monitor token expiration.
- Use refresh token to obtain new access token.
Copied to your clipboardPOST https://ims-na1.adobelogin.com/ims/token/v3Authorization: Basic {{base64(client_id:client_secret)}}Content-Type: application/x-www-form-urlencodedgrant_type=refresh_token&refresh_token={{refresh_token}}
Copied to your clipboard{"access_token": "{ACCESS_TOKEN}","refresh_token": "{REFRESH_TOKEN}","expires_in": 86399,"token_type": "bearer"}
- Update the stored tokens.
Token storage best practices:
- Secure storage methods
- Encryption at rest
- Token rotation procedures
Usage examples
API request format
Copied to your clipboardGET /rest/v1/productsAuthorization: Bearer <access_token>Error handling
- Token expiration handling
- Invalid token responses
- Scope-related errors
Token refresh flow
- Detecting expired tokens
- Automatic refresh implementation
- Session management