All Products
Search
Document Center

Identity as a Service:Alibaba Cloud OpenAPI authentication

Last Updated:Jun 03, 2026

If federated credentials such as PKCS#7 or OpenID Connect (OIDC) are unavailable, you can obtain an IDaaS client access token through Alibaba Cloud OpenAPI. This guide covers the required RAM permission configuration.

OpenAPI authentication requires an STS Token obtained by assuming a RAM role with IDaaS permissions. You then call the IDaaS OpenAPI with this STS Token to retrieve an access token for your application. The following steps use Function Compute as an example.

Create a permission policy

  1. Log on to the RAM console.

  2. In the navigation pane, choose Permissions > Policies.

  3. Click Create Policy.

  4. Click the JSON Editor tab and paste the following policy.

    {
      "Version": "1",
      "Statement": [
        {
          "Effect": "Allow",
          "Action": "eiam:GenerateOauthToken",
          "Resource": [
            "acs:eiam:<regionId>:<accountId>:instance/<InstanceId>/application/<ApplicationId>"
          ]
        }
      ]
    }

    Replace the Resource placeholders: <regionId> with the region ID of your IDaaS EIAM instance, <accountId> with your Alibaba Cloud account ID, <InstanceId> with your IDaaS EIAM instance ID, and <ApplicationId> with the target M2M client application ID.

  5. Click OK and name the policy, for example, openapi-authentication-policy.

Create and authorize a RAM role

  1. Log on to the RAM console.

  2. In the navigation pane, choose Identities > Roles.

  3. Click Create Role. Set Principal Type to Cloud Service and Principal Name to Function Compute / FC.

  4. Click OK and name the role, for example, openapi-authentication-fc-role.

  5. Find the role and click Actions in the Attach Policy column.

  6. In the Policy field, select openapi-authentication-policy, and click OK.

Attach the RAM role

  1. Log on to the Function Compute console.

  2. In the navigation pane, choose Function Management > Function List.

  3. Find the function and click Actions in the Configure column.

  4. On the Function Details tab, click Modify next to Advanced Settings.

  5. Under Permissions, select the openapi-authentication-fc-role role.

  6. Click Deploy.

To configure function roles for cross-service access, follow Grant Function Compute permissions to access other cloud services by using a function role.