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

Authentication

Updated on 2023-12-13 GMT+08:00

You can use either of the following authentication methods when calling APIs:

  • Authentication using tokens: General requests are authenticated using tokens.

    To call the Silvan interface of an API gateway, use token authentication. The token whose roles is op_service must be used. The administrator account of each service has the op_service permission.

  • Authentication using the AK/SK: Requests are encrypted using the access key ID (AK)/secret access key (SK).

    To use an API gateway to send requests to underlying services, sign the requests using the AK and SK.

Token Authentication

NOTE:

The validity period of a token is 24 hours. When using a token for authentication, cache it to prevent frequently calling the IAM API.

A token specifies certain permissions in a computer system. Authentication using a token adds the token to a request as its header during API calling to obtain permissions to operate APIs through IAM.

When calling the API to obtain a user token, you must set auth.scope in the request body to project.

For details about how to obtain username and domainname , see Obtaining the Account Name and Account ID. password indicates the user password.

{ 
    "auth": { 
        "identity": { 
            "methods": [ 
                "password" 
            ], 
            "password": { 
                "user": { 
                    "name": "username", 
                    "password": "********", 
                    "domain": { 
                        "name": "domainname" 
                    } 
                } 
            } 
        }, 
        "scope": { 
            "project": { 
                "name": "xxxxxxxx" 
            } 
        } 
    } 
}

To call the Silvan interface of an API gateway, you must obtain the user's token and add X-Auth-Token to the request header of a service API.

After obtaining the token, add the X-Auth-Token header to a request to specify the token when calling other APIs. For example, if the token is ABCDEFJ...., add X-Auth-Token: ABCDEFJ.... to a request as follows:

GET https://iam.ap-southeast-1.myhuaweicloud.com/v3/auth/projects
Content-Type: application/json 
X-Auth-Token: ABCDEFJ....

Procedure

This section describes how to perform token authentication for API calling.

  1. Send POST https://IAM endpoint/v3/auth/tokens to obtain the endpoint of the Identity and Access Management (IAM) service and the region name in the message body.For details, see Regions and Endpoints.

    A sample request is as follows:

    {
      "auth": {
        "identity": {
          "methods": [
            "password"
          ],
          "password": {
            "user": {
              "name": "username",  //Username
              "password": "password",  //Password
              "domain": {
                "name": "domainname"  //Account name
              }
            }
          }
        },
        "scope": {
          "project": {
            "name": "ap-southeast-1"  //Region of Image Search
          }
        }
      }
    }
    NOTE:

    Replace the items in italic in the preceding code snippet with actual ones. For details, see the Identity and Access Management API Reference.

  2. Obtain the token. For details about how to obtain the token, see Obtaining a User Token in the Identity and Access Management API Reference. The token value is the X-Subject-Token value in the response header.
  3. To call a service API, add the X-Auth-Token header to the request and set its value to the token obtained in Step 2.

AK/SK Authentication

NOTE:

Authentication using the AK/SK supports API requests with a body not larger than 12 MB. For API requests with a larger body, authentication using tokens is recommended.

When the API gateway sends a request to the underlying service, the AK/SK must be used to sign the request. For details, see the API Request Signing Guide.

In authentication using the AK/SK, the AK/SK is used to sign a request and add the signature to a request as its header for authentication.

  • AK: indicates the ID of the access key. It is the unique identifier associated with the SK. The AK and SK are used together to sign requests cryptographically.
  • SK: indicates the secret access key used together with the AK to sign requests cryptographically. AK and SK can be used together to identify a request sender to prevent the request from being modified.

In authentication using the AK/SK, you can use the AK/SK to sign requests based on the signature algorithm or use a dedicated signature SDK to sign the requests. For details about how to sign requests and use the signature SDK, see the API Request Signing Guide.

NOTICE:

The signature SDK supports only signature, which is different from the SDKs provided by services.

When the AK/SK of a user under a domain is used, add X-Domain-Id to the header and set it to the user's domain ID.

Obtaining AK/SK

  1. Register with HUAWEI CLOUD and log in to the Image Search management console.
  2. Hover the cursor on the username in the upper right corner and select My Credentials from the drop-down list. On the My Credentials page, click the Access Keys tab.
  3. Click Add Access Key. The Add Access Key dialog box is displayed.
  4. Enter the login password of the current user and the verification code received in the email or on the mobile phone. Click OK to download the access key.

    NOTE:
    • For users created in IAM, if no email address or mobile phone number is specified during user creation, you only need to enter the login password for verification.
    • To prevent the access key from being leaked, keep it secure.

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