Using Tencent Cloud Signature V3 Authentication
The Cloud Development HTTP API supports authentication and calling interfaces via Tencent Cloud Signature Method V3. Reference documentation for Tencent Cloud Signature Method V3: https://cloud.tencent.com/document/product/876/34813.
In Tencent Cloud Signature Method V3, the CanonicalURI
field in the canonical request string CanonicalRequest
is fixed as /
. However, when computing the Cloud Development HTTP API, the CanonicalURI
must be filled with the actual request path. For example, when requesting the AI large model interface /v1/ai/hunyuan/
, the CanonicalURI
for the signature is /v1/ai/hunyuan/
.
According to Signature Method V3, a signature similar to the following format can be generated:
TC3-HMAC-SHA256 Credential=*************/2018-06-08/tcb/tc3_request, SignedHeaders=content-type;host;x-tc-action, Signature=*************
After obtaining the above signature, the Timestamp
(i.e., the value of the public parameter X-Tc-Timestamp
) used in the signature is appended after the signature string, resulting in:
TC3-HMAC-SHA256 Credential=*************/2024-08-08/tcb/tc3_request, SignedHeaders=content-type;host;x-tc-action, Signature=*************, Timestamp=*******
If temporary access credentials are used in the signature, the Token
of the temporary access credentials (i.e., X-Tc-Token
) must be appended as a parameter after the signature string. The method to obtain temporary access credentials can be found at: https://cloud.tencent.com/document/product/1312/48197. After appending, the result is:
TC3-HMAC-SHA256 Credential=*************/2024-08-08/tcb/tc3_request, SignedHeaders=content-type;host;x-tc-action, Signature=*************, Timestamp=*******, Token=*************
Use the signature string obtained from the above process as the value of the request header Authorization
, and pass it when calling the HTTP API, for example:
curl 'https://${your-env}.api.tcloudbasegateway.com/${path}' \
-H 'Authorization: TC3-HMAC-SHA256 Credential=*************/2024-08-08/tcb/tc3_request, SignedHeaders=content-type;host;x-tc-action, Signature=*************, Timestamp=*******, Token=*************'
Currently, the following functional modules do not support direct invocation using Tencent Cloud Signature V3:
- Data Model
- User Authentication
For features that do not support direct invocation using Tencent Cloud Signature V3, they can be called by obtaining an OAuth 2.0 Access Token. Reference documentation: https://docs.cloudbase.net/http-api/basic/access-token.