Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Obtaining a Token with an OpenID Connect ID Token

Updated on 2024-11-18 GMT+08:00

Function

This API is used to obtain a federated identity authentication token using an OpenID Connect ID token.

The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.

Debugging

You can debug this API in API Explorer.

URI

POST /v3.0/OS-AUTH/id-token/tokens

Request Parameters

Table 1 Parameters in the request header

Parameter

Mandatory

Type

Description

X-Idp-Id

Yes

String

Identity provider ID.

Table 2 Parameter in the request body

Parameter

Mandatory

Type

Description

auth

Yes

object

Details about the auth request parameter.

Table 3 GetIdTokenAuthParams

Parameter

Mandatory

Type

Description

id_token

Yes

object

Details about an ID token.

scope

No

object

Permission scope of the token you want to obtain. An unscoped token will be obtained if this parameter is not specified.

Table 4 GetIdTokenIdTokenBody

Parameter

Mandatory

Type

Description

id

Yes

String

ID token, which is constructed by the enterprise IdP to carry the identity information of federated users. For details about how to obtain an ID token, see the enterprise IdP documentation.

Table 5 GetIdTokenIdScopeBody

Parameter

Mandatory

Type

Description

domain

No

object

Domain scope details. Specify a domain or a project.

project

No

object

Project scope details. Specify a project or a domain.

Table 6 GetIdTokenScopeDomainOrProjectBody

Parameter

Mandatory

Type

Description

id

No

String

Domain ID or project ID. Specify either this parameter or the name parameter.

name

No

String

Domain name or project name. Specify either this parameter or the id parameter.

Response Parameters

Status code: 201

Table 7 Parameters in the response header

Parameter

Type

Description

X-Subject-Token

String

Signed token.

Table 8 Parameters in the response body

Parameter

Type

Description

token

object

Details about the obtained token.

Table 9 token

Parameter

Type

Description

expires_at

String

Time when the token will expire.

NOTE:

The value is a UTC time in the YYYY-MM-DDTHH:mm:ss.ssssssZ format, for example, 2023-06-28T08:56:33.710000Z. For details about the date and timestamp formats, see ISO-8601.

methods

Array of strings

Method for obtaining the token. For federated users, the default value of this parameter is mapped.

issued_at

String

Time when the token was issued.

NOTE:

The value is a UTC time in the YYYY-MM-DDTHH:mm:ss.ssssssZ format, for example, 2023-06-28T08:56:33.710000Z. For details about the date and timestamp formats, see ISO-8601.

user

object

User details.

domain

object

Account details.

project

object

Project details. This parameter is only returned when the scope is set to project.

roles

Array of objects

Role or policy details.

catalog

Array of objects

Catalog details.

Table 10 token.user

Parameter

Type

Description

OS-FEDERATION

object

Federated user details.

domain

object

Account details.

id

String

User ID.

name

String

Username.

Table 11 token.user.OS-FEDERATION

Parameter

Type

Description

identity_provider

object

Identity provider details.

protocol

object

Protocol details.

groups

Array of objects

User group details.

Table 12 token.user.OS-FEDERATION.identity_provider

Parameter

Type

Description

id

String

Identity provider ID.

Table 13 token.user.OS-FEDERATION.protocol

Parameter

Type

Description

id

String

Protocol ID.

Table 14 token.user.OS-FEDERATION.groups

Parameter

Type

Description

id

String

User group ID.

name

String

User group name.

Table 15 token.user.domain

Parameter

Type

Description

id

String

Account ID.

name

String

Account name.

Table 16 token.domain

Parameter

Type

Description

id

String

Account ID.

name

String

Account name.

Table 17 token.project

Parameter

Type

Description

domain

object

Account details.

id

String

Project ID.

name

String

Project name.

Table 18 token.project.domain

Parameter

Type

Description

id

String

Account ID.

name

String

Account name.

Table 19 roles

Parameter

Type

Description

id

String

Permission ID.

name

String

Permission name.

Table 20 token.catalog

Parameter

Type

Description

endpoints

Array of objects

Endpoint information.

id

String

Service ID.

name

String

Service name.

type

String

Type of the service which the API belongs to.

Table 21 token.catalog.endpoints

Parameter

Type

Description

id

String

Endpoint ID.

interface

String

Visibility of the API. public indicates that the API is available for public access.

region

String

Region which the endpoint belongs to.

region_id

String

Region ID.

url

String

Endpoint URL.

Table 22 CatalogInfo

Parameter

Type

Description

id

String

Endpoint ID.

interface

String

Visibility of the API. public indicates that the API is available for public access.

region

String

Region which the endpoint belongs to.

region_id

String

Region ID.

url

String

Endpoint URL.

Example Request

  • Request for obtaining a scoped token for a specific project
    POST /v3.0/OS-AUTH/id-token/tokens
      
     { 
       "auth" : { 
         "id_token" : { 
           "id" : "eyJhbGciOiJSU..." 
         }, 
         "scope" : { 
           "project" : { 
             "id" : "46419baef4324...", 
             "name" : "ap-southeast-1" 
           } 
         } 
       } 
     }
  • Request for obtaining a scoped token for a specific domain
    POST /v3.0/OS-AUTH/id-token/tokens
     
      
     { 
       "auth" : { 
         "id_token" : { 
           "id" : "eyJhbGciOiJSU..." 
         }, 
         "scope" : { 
           "domain" : { 
             "id" : "063bb260a480...", 
             "name" : "IAMDomain" 
           } 
         } 
       } 
     }
  • Request for obtaining an unscoped token
    POST /v3.0/OS-AUTH/id-token/tokens
     
      
     { 
       "auth" : { 
         "id_token" : { 
           "id" : "eyJhbGciOiJSU..." 
         } 
       } 
     }

Example Response

Status code: 201

The token is obtained successfully.

{ 
  "token" : { 
    "expires_at" : "2018-03-13T03:00:01.168000Z", 
    "methods" : [ "mapped" ], 
    "issued_at" : "2018-03-12T03:00:01.168000Z", 
    "user" : { 
      "OS-FEDERATION" : { 
        "identity_provider" : { 
          "id" : "idptest" 
        }, 
        "protocol" : { 
          "id" : "oidc" 
        }, 
        "groups" : [ { 
          "name" : "admin", 
          "id" : "45a8c8f..." 
        } ] 
      }, 
      "domain" : { 
        "id" : "063bb260a480...", 
        "name" : "IAMDomain" 
      }, 
      "name" : "FederationUser", 
      "id" : "suvmgvUZc4PaCOEc..." 
    } 
  } 
}

Status code: 400

Invalid parameters.

{ 
  "error_msg" : "Request body is invalid.", 
  "error_code" : "IAM.0011" 
}

Status code: 401

Authentication failed.

{ 
  "error_msg" : "The request you have made requires authentication.", 
  "error_code" : "IAM.0001" 
}

Status code: 403

Access denied.

{ 
  "error_msg" : "Policy doesn't allow %(actions)s to be performed.", 
  "error_code" : "IAM.0003" 
}

Status code: 404

The requested resource cannot be found.

{ 
  "error_msg" : "Could not find %(target)s: %(target_id)s.", 
  "error_code" : "IAM.0004" 
}

Status code: 500

Internal system error.

{ 
  "error_msg" : "An unexpected error prevented the server from fulfilling your request.", 
  "error_code" : "IAM.0006" 
}

Status Codes

Status Code

Description

201

The token is obtained successfully.

400

Invalid parameters.

401

Authentication failed.

403

Access denied.

404

The requested resource cannot be found.

500

Internal system error.

Error Codes

For details, see Error Codes.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback