|
1 | 1 | ---
|
2 | 2 | title: Authentication in Adobe Commerce as a Cloud Service
|
3 |
| -description: Generate the IMS access token for admin user. |
| 3 | +description: Learn about REST API authentication in Adobe Commerce as a Cloud Service. |
4 | 4 | edition: saas
|
5 | 5 | keywords:
|
6 | 6 | - REST
|
7 | 7 | - Integration
|
8 |
| ---- |
9 |
| - |
10 |
| -# Authentication in Adobe Commerce as a Cloud Service |
11 |
| - |
12 |
| -In Adobe Commerce as a Cloud Service (SaaS), you must use Adobe's Identity Management Service (IMS) for admin authentication. The traditional admin token generation method is not supported in SaaS environments. Instead, you must obtain an IMS admin token through OAuth authentication. |
13 |
| - |
14 |
| -This authentication method ensures that all API calls are performed within the context of the authenticated admin user's permissions, as defined in the ACCS. |
15 |
| - |
16 |
| -<InlineAlert variant="note" slots="text"/> |
17 |
| - |
18 |
| -See [Authentication](../../get-started/authentication/index.md) in the _Get Started_ guide for information about the authentication methods available on other versions of Adobe Commerce. |
19 |
| - |
20 |
| -## Authentication Options for Adobe Commerce as a Cloud Service |
21 |
| - |
22 |
| -Adobe Commerce as a Cloud Service (ACCS) supports two primary authentication methods for admin-level API access: |
23 |
| - |
24 |
| -- **User authentication (IMS)** - Use this method when you need to authenticate on behalf of a specific admin user with user-specific permissions. This page covers the user authentication flow. |
25 |
| - |
26 |
| -- **Server-to-server integration** - Use this method for automated system-to-system communication without user intervention. For detailed instructions on setting up server-to-server integration, see [Create server-to-server integration](server-to-server.md). |
27 |
| - |
28 |
| -## Security best practices |
29 |
| - |
30 |
| -- Store tokens securely using encryption at rest. |
31 |
| -- Implement proper token rotation procedures. |
32 |
| -- Monitor token expiration and implement automatic refresh. |
33 |
| -- Use HTTPS for all authentication requests. |
34 |
| -- Validate state parameters to prevent CSRF attacks. |
35 |
| - |
36 |
| -## Generate an IMS access token |
37 |
| - |
38 |
| -Before implementing IMS authentication, ensure you have: |
39 |
| - |
40 |
| -- An active Adobe Commerce as a Cloud Service license. |
41 |
| -- Access to Adobe Developer Console for creating OAuth credentials. |
42 |
| -- A configured redirect URI where users will return after authentication. |
43 |
| -- A secure environment for token handling. |
44 |
| - |
45 |
| -### Step 1: Generate IMS credentials |
46 |
| - |
47 |
| -1. Navigate to Adobe Developer Console. |
48 |
| -1. Create or select a project that will house your authentication credentials. |
49 |
| -1. Add the **Adobe Commerce with Adobe ID** API to your project. |
50 |
| -1. Select your preferred OAuth 2 authentication type: |
51 |
| - - **Web App**: For applications with a backend server that can securely store client secrets |
52 |
| - - **Single-Page App (SPA)**: For browser-based JavaScript applications |
53 |
| - - **Native App**: For device-native applications (iOS, Android, desktop) |
54 |
| -1. Configure the allowed redirect URIs. |
55 |
| -1. Copy the client ID and client secret. |
56 |
| -1. Securely save your credentials. |
57 |
| - |
58 |
| -### Step 2: Implement the authorization flow and response |
59 |
| - |
60 |
| -To authenticate a user and obtain an authorization code, follow these steps: |
61 |
| - |
62 |
| -1. Create an authorization URL to initiate the authentication process. The URL has the following format: |
63 |
| - |
64 |
| - ```http |
65 |
| - https://ims-na1.adobelogin.com/ims/authorize/v2?client_id={{client_id}}&redirect_uri={{redirect_uri}}&scope={{scopes}}&state=something&response_type=code |
66 |
| - ``` |
67 |
| - |
68 |
| - Replace the placeholders with your values: |
69 |
| - |
70 |
| - - `{{client_id}}`: Your IMS client ID |
71 |
| - - `{{redirect_uri}}`: Your configured redirect URI |
72 |
| - - `{{scopes}}`: A comma-separated list of required scopes, such as `AdobeID,openid,email,profile,additional_info.roles,additional_info.projectedProductContext` |
73 |
| - |
74 |
| -1. Handle the authorization response. When the user completes authentication through Adobe's login interface, the browser redirects to your `redirect_uri`. The authorization code is included in URL parameters: |
75 |
| - |
76 |
| - `?code={{auth_code}}&state=something` |
77 |
| - |
78 |
| - Extract the authorization code and verify the state parameter |
79 |
| - |
80 |
| -### Step 3: Exchange the authorization code for an access token |
81 |
| - |
82 |
| -Make a POST request to exchange the authorization code for an access token: |
| 8 | +--- |
83 | 9 |
|
84 |
| -**Endpoint:** |
| 10 | +# REST Authentication in Adobe Commerce as a Cloud Service |
85 | 11 |
|
86 |
| -`POST https://ims-na1.adobelogin.com/ims/token/v3` |
| 12 | +Adobe Commerce as a Cloud Service REST API authentication is handled through Adobe's Identity Management System (IMS) through standardized OAuth 2 protocols. This authentication system supports both interactive user-based workflows and automated server-to-server integrations, ensuring secure and appropriate access for different use cases. The traditional admin and integration token generation methods is not supported in SaaS environments. Instead, you must obtain an IMS admin token through OAuth authentication. |
87 | 13 |
|
88 |
| -**Headers:** |
| 14 | +The following types of authentication are available for Adobe Commerce as a Cloud Service REST APIs: |
89 | 15 |
|
90 |
| -```text |
91 |
| -Authorization: Basic {{base64(client_id:client_secret)}} |
92 |
| -Content-Type: application/x-www-form-urlencoded |
93 |
| -``` |
| 16 | +- [Server-to-server authentication](#server-to-server-authentication) - Choose this flow for automated, system-to-system integrations that do not require user interaction, such as background jobs, integrations, and scripts. |
94 | 17 |
|
95 |
| -**Payload:** |
| 18 | +- [User authentication](#user-authentication) - Choose this flow when API operations must be performed by an admin user according to their permissions, such as when actions must be attributed to a specific admin user. |
96 | 19 |
|
97 |
| -```text |
98 |
| -code={{auth_code}}&grant_type=authorization_code |
99 |
| -``` |
| 20 | +See [Authentication](../../get-started/authentication/index.md) in the _Get Started_ guide for information about the authentication methods available on other versions of Adobe Commerce. |
100 | 21 |
|
101 |
| -**Response:** |
| 22 | +## Server-to-server authentication |
102 | 23 |
|
103 |
| -```json |
104 |
| -{ |
105 |
| - "access_token": "{ACCESS_TOKEN}", |
106 |
| - "refresh_token": "{REFRESH_TOKEN}", |
107 |
| - "sub": "A0BC123D4CD449CA0A494133@a12b34cd5b5b7e0e0a494004", |
108 |
| - "id_token": "{ID_TOKEN}", |
109 |
| - "token_type": "bearer", |
110 |
| - "expires_in": 86399 |
111 |
| -} |
112 |
| -``` |
| 24 | +Server-to-server authentication enables automated systems to interact with Commerce APIs without user intervention. This method uses technical account credentials to obtain access tokens directly, making it perfect for background processes, scheduled tasks, and system integrations that need to operate independently. |
113 | 25 |
|
114 |
| -### Step 4: Use the access token |
| 26 | +Key benefits of this approach include: |
115 | 27 |
|
116 |
| -Use the access token in the Authorization header for all Commerce REST API calls, such as retrieving a list of products. |
| 28 | +- Non-interactive authentication for automated processes |
| 29 | +- Obtain a new access token as needed using client credentials |
| 30 | +- Ideal for headless and backend integrations |
| 31 | +- Support for system-wide permissions and access control |
117 | 32 |
|
118 |
| -**Endpoint:** |
| 33 | +For detailed steps, see the [server-to-server Authentication Guide](./server-to-server.md). |
119 | 34 |
|
120 |
| -`GET https://<server>.api.commerce.adobe.com/<tenant-id>/v1/products` |
| 35 | +## User authentication |
121 | 36 |
|
122 |
| -**Headers:** |
| 37 | +The user authentication flow provides a secure, OAuth-based workflow where users authenticate through Adobe IMS, ensuring credentials are never directly handled by your application. |
123 | 38 |
|
124 |
| -```text |
125 |
| -Authorization: Bearer {ACCESS_TOKEN} |
126 |
| -``` |
| 39 | +Key benefits of this approach include: |
127 | 40 |
|
128 |
| -## Token refresh |
| 41 | +- Direct integration with Adobe's secure authentication interface |
| 42 | +- Automatic handling of user permissions based on Adobe Commerce Admin role |
| 43 | +- Support for interactive workflows in admin applications |
| 44 | +- Token refresh capabilities for extended sessions |
| 45 | +- Compliance with OAuth 2 security standards |
129 | 46 |
|
130 |
| -Access tokens expire after a certain period (typically 24 hours). Use the refresh token to obtain a new access token: |
| 47 | +For detailed steps, see the [User Authentication Guide](./user.md). |
131 | 48 |
|
132 |
| -**Endpoint:** |
| 49 | +## Getting started |
133 | 50 |
|
134 |
| -`POST https://ims-na1.adobelogin.com/ims/token/v3` |
| 51 | +The following concepts apply to both authentication flows and are important for successful integration: |
135 | 52 |
|
136 |
| -**Headers:** |
| 53 | +- Prerequisites: |
| 54 | + - Adobe Commerce as a Cloud Service license |
| 55 | + - Adobe Developer Console access |
| 56 | + - Understanding of OAuth 2 |
| 57 | +- Environment preparation: |
| 58 | + - Development environment |
| 59 | + - Adobe Developer Console project configuration |
| 60 | + - API testing tools |
137 | 61 |
|
138 |
| -```text |
139 |
| -Authorization: Basic {{base64(client_id:client_secret)}} |
140 |
| -Content-Type: application/x-www-form-urlencoded |
141 |
| -``` |
| 62 | +## Access tokens |
142 | 63 |
|
143 |
| -**Payload:** |
| 64 | +- Use the bearer token type for API authorization |
| 65 | +- Include your access token in the Authorization header of REST API requests |
| 66 | +- Familiarize yourself with token lifecycle management and renewal processes |
| 67 | +- Review security considerations and best practices for token storage |
144 | 68 |
|
145 |
| -```json |
146 |
| -grant_type=refresh_token&refresh_token={{refresh_token}} |
147 |
| -``` |
| 69 | +## Scopes |
148 | 70 |
|
149 |
| -**Response:** |
| 71 | +The following permission scopes are required for Adobe Commerce as a Cloud Service REST API access: |
150 | 72 |
|
151 |
| -```json |
152 |
| -{ |
153 |
| - "access_token": "{ACCESS_TOKEN}", |
154 |
| - "refresh_token": "{REFRESH_TOKEN}", |
155 |
| - "expires_in": 86399, |
156 |
| - "token_type": "bearer" |
157 |
| -} |
158 |
| -``` |
| 73 | +- `AdobeID` |
| 74 | +- `openid` |
| 75 | +- `email` |
| 76 | +- `profile` |
| 77 | +- `additional_info.roles` |
| 78 | +- `additional_info.projectedProductContext` |
| 79 | +- `commerce.accs` |
0 commit comments