You can use the Open Authorization (OAuth) 2.0 protocol together with Alibaba Cloud Resource Access Management (RAM) to authenticate users and authorize applications to access specific Alibaba Cloud resources. This topic introduces the basic terms of OAuth 2.0 and describes the common scenarios and scopes of OAuth 2.0.
Terms
Term | Description |
user | A user must log on to Alibaba Cloud before the user can authorize an application to access specific Alibaba Cloud resources. The user can be the owner of an Alibaba Cloud account or a RAM user. Note OAuth applications that were created before September 10, 2024 do not support RAM roles. If you want to use RAM roles, submit a ticket. |
Alibaba Cloud OAuth 2.0 service | A service that is used to authenticate users and generate tokens for applications to access specific Alibaba Cloud resources on behalf of users. |
OAuth application | An application that can access Alibaba Cloud resources after being authorized by a user and obtaining tokens of the user. The OAuth 2.0 service supports the following types of applications:
Applications can be classified into the following types based on their ownership:
|
OAuth scope | The scope within which an application is allowed to access Alibaba Cloud resources on behalf of a user. The following scopes are supported:
|
token | The token that is issued by OAuth 2.0 to an application.
|
Alibaba Cloud API | The API that an application can call to access Alibaba Cloud resources. |
Scenarios
OAuth scopes
Alibaba Cloud RAM provides three OAuth scopes: openid, aliuid, and profile. If different scopes are added, you can obtain different information. The following table describes the information.
Parameter | Description | Example | Required OAuth scope |
exp | The timestamp when the token expires. | 1517539523 | openid |
sub | A unique string that identifies the user. The string does not contain the UID and username of the user. Note If the user assumes a RAM role, the value of the sub parameter is generated based on | 123456789012**** | openid |
aud | The receiver of the token, which is the ID of the OAuth application. | 4567890123456**** | openid |
iss | The issuer of the token. Valid value: | https://oauth.aliyun.com | openid |
iat | The timestamp when the token was issued. | 1517533200 | openid |
aid | The ID of the Alibaba Cloud account to which the user belongs. | 177242285274**** | aliuid |
uid | The ID of the user. Valid values:
| 20124982101502**** | aliuid |
type | The type of the user. Valid values:
| user | profile |
login_name | The logon name of the Alibaba Cloud account. Note This parameter is returned only if an Alibaba Cloud account initiates the request. | Alice | profile |
upn | The logon name of the RAM user. Note This parameter is returned only if a RAM user initiates the request. | Bob@examplecompany.onaliyun.com | profile |
name | The name of the user. Valid values:
Note This parameter is returned only if a RAM user or a RAM role initiates the request. | Bob | profile |