Partner CenterPartner Center

Compute
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
Domain Name Service
VPC Endpoint
Cloud Connect
Enterprise Switch
Security & Compliance
Anti-DDoS
Web Application Firewall
Host Security Service
Data Encryption Workshop
Database Security Service
Advanced Anti-DDoS
Data Security Center
Container Guard Service
Situation Awareness
Managed Threat Detection
Compass
Cloud Certificate Manager
Anti-DDoS Service
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GaussDB NoSQL
GaussDB(for MySQL)
Distributed Database Middleware
GaussDB(for openGauss)
Developer Services
ServiceStage
Distributed Cache Service
Simple Message Notification
Application Performance Management
Application Operations Management
Blockchain Service
API Gateway
Cloud Performance Test Service
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
DevCloud
ProjectMan
CodeHub
CloudRelease
CloudPipeline
CloudBuild
CloudDeploy
Cloud Communications
Message & SMS
Cloud Ecosystem
Marketplace
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP License Service
Support Plans
Customer Operation Capabilities
Partner Support Plans
Professional Services
enterprise-collaboration
Meeting
IoT
IoT
Intelligent EdgeFabric
DeveloperTools
SDK Developer Guide
API Request Signing Guide
Terraform
HCloud CLI
Help Center> Partner Center> API Reference> Appendix> How Can I Replace a Partner Token with a Customer Token
Updated at: Apr 13, 2022 GMT+08:00

How Can I Replace a Partner Token with a Customer Token

Operations

  1. Invoke the IAM API to obtain your HUAWEI CLOUD account token. For details, see Obtaining a User Token.

    For details about the IAM API endpoints, see Regions and Endpoints. If the scope field in the request body is domain, use the endpoint with Region being All. If the scope field is set to project, you can use the endpoint with Region being All, or the endpoint of the region to which the project belongs.

    In this step, no token needs to be transferred. You only need to add Content-Type to the header, and set its value to application/json. As shown in Figure 1, the x-subject-token field in the red box on the Headers tab is your account token.

    Example request

    {
        "auth": {
            "identity": {
                "methods": [
                    "password"
                ],
                "password": {
                    "user": {
                        "name": "Partner's HUAWEI CLOUD account",
                        "domain": {
                        "name": "Partner's HUAWEI CLOUD account",
                        },
                        "password": "XXXXX"
                    }
                }
            },
            "scope": {
                "domain": {
                     "name": "Partner's HUAWEI CLOUD account",
                }
            }
        }
    }
    Figure 1 Obtaining partner's HUAWEI CLOUD account token
  2. Invoke the IAM API to obtain the customer HUAWEI CLOUD account token. For details, see Obtaining a User Token with the assume_role Method.

    Add Content-Type and X-Auth-Token to the request header. Set Content-Type to application/json and X-Auth-Token to the BP token obtained in 1. As shown in Figure 2, the x-subject-token field in the red box on the Headers tab is the customer account token. A partner can use the customer's HUAWEI CLOUD account token to perform operations on resources in the customer's HUAWEI CLOUD account.

    Example request:

    {
        "auth": {
            "identity": {
                "methods": [
                    "assume_role"
                ],
                "assume_role": {
                     "domain_name": "Customer's HUAWEI CLOUD account",
                    "xrole_name": "Agency name (xaccountType)"
                }
            },
            "scope": {
                "project": {
                    "name": "Project name of the customer's resources
                }
            }
        }
    }
    Figure 2 Obtaining customer's HUAWEI CLOUD account token

    Response body descriptions

    • readonly indicates that the account has the Tenant Guest permissions. te_admin indicates that the account has the Tenant Administrator permissions.
      Figure 3 Permissions descriptions
    • Information marked in the red box in Figure 4 is the project ID.
      Figure 4 Project ID

Did you find this page helpful?

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel