Alibaba Cloud supports the OAuth 2.0 and 2.1 frameworks, which allow client applications to securely obtain delegated access to Alibaba Cloud resources on behalf of a user. This topic provides an overview of the key concepts, common use cases, and supported OAuth scopes.
How it works: The authorization flow
The Alibaba Cloud OAuth service uses standard OAuth 2.0 flows, such as the authorization code flow. The general process is as follows:
Authorization request: The client application redirects the user to the Alibaba Cloud authorization server to request access. The request specifies the desired permissions (scopes).
User consent: The authorization server authenticates the user and prompts them to grant or deny the application's request for access.
Authorization grant: If the user grants access, the authorization server redirects the user back to the application with an authorization code.
Token exchange: The application exchanges the authorization code for an access token (and optionally an ID token and refresh token) by making a back-channel request to the authorization server.
Resource access: The application uses the access token to make secure API calls to Alibaba Cloud services on behalf of the user.
Key concepts
Concept | Description |
Resource owner | The user who owns the resources and grants permission to the application. A resource owner can be an Alibaba Cloud account, a RAM user, or a RAM role. Note Support for RAM roles as resource owners is available for OAuth applications created after September 10, 2024. To enable this feature for older applications, you can submit a ticket. |
Client application | The application requesting access to the resource owner's resources. Alibaba Cloud supports the following application types:
Applications can also be classified as first-party (developed within your account) or third-party (developed by another account and installed by you). |
Authorization server | The Alibaba Cloud OAuth service, which is responsible for authenticating the resource owner, obtaining their consent, and issuing tokens to the client application. |
OAuth scope | Defines the specific permissions the application is requesting. The issued access token is limited to the scopes granted by the user. Identity scopes:
Resource scopes:
|
Token | A security credential issued by the authorization server.
|
Common use cases
Third-party web application access
A third-party monitoring service uses OAuth to request read-only access to a user's Elastic Compute Service (ECS) metrics. The user logs on to Alibaba Cloud, consents to the requested permissions, and the application receives an access token to call Cloud Monitor APIs on their behalf.
Desktop or mobile application integration
A mobile application for managing Object Storage Service (OSS) buckets uses OAuth to allow users to log on with their Alibaba Cloud account. After the user grants consent, the app gets an access token to list buckets and upload or download objects.
Automated identity provisioning
An enterprise uses a third-party identity management solution (like Microsoft Entra ID or Okta) to automate the creation, update, and deletion of RAM users in Alibaba Cloud. The solution is configured as a server-to-server OAuth application with the /acs/scim scope to interact with the RAM SCIM endpoint.
ID token claims
If the openid, aliuid, and profile scopes are granted, the returned ID token can contain the following claims:
Claim | Description | Required scope |
| A unique, non-PII identifier for the user. For a RAM role, the value is |
|
| The ID of your OAuth application. |
|
| The URL of the authorization server: |
|
| The UNIX timestamp when the token expires. |
|
| The UNIX timestamp when the token was issued. |
|
| The ID of the Alibaba Cloud account to which the user belongs. |
|
| The UID of the authenticated principal (Alibaba Cloud account ID, RAM user ID, or RAM role ID). |
|
| The type of the authenticated principal. Valid values: |
|
| The logon name of the authenticated principal. This claim is returned only for Alibaba Cloud accounts. |
|
| The User Principal Name (UPN) of the authenticated principal. This claim is returned only for RAM users. |
|
| The display name of the authenticated principal. For a RAM role, this is |
|