Authentication of Signature in a Header

For all API operations, the most common identity authentication is to carry signatures in headers.

In the header, the signature is carried in the Authorization header field of the HTTP message. The format of the message header is as follows:

Authorization: SDK-HMAC-SHA256 Credential=ak/CredentialScope, SignedHeaders=SignedHeaders, Signature=signature

Parameters to be Prepared before Signing a Signature

Table 1 Parameters related to the request signature

Parameter

Description

Example

method

Request type.

POST

ak

User AK.

DJZN5UEQSODCWJ7NGOMC

sk

User SK.

vRNwGMd92PlityIO3daDseoS9hciL9xKSKkBiJ44

projectId

User project ID.

d575b0b740e54221aeb9a165653b103d

region

Information about the region where the service is located (cn-north-4 indicates CN North-Beijing4)

-

url

Request URL.

https://dis.${region}.myhuaweicloud.com:20004/v2/d575b0b740e54221aeb9a165653b103d/records/?stream-name=test2&partition-id=0

content

Request body.

{"stream_name":"test2","records":[{"data":"aGVsbG8gd29ybGQu","partition_id":"","explicit_hash_key":"","partition_key":"0"}]}

service

Service abbreviation.

dis

header

HTTP request header (The request header in the signature is not mandatory. You can add a user-defined request header after the signature is complete. If there is a request header before the signature, all request headers need to be put into the signature calculation process during the signature.)

-