To provide more secure API authentication, we recommend using digital signature authentication for accessing interfaces. Digital signature authentication is a more secure alternative to using API keys alone. It involves encrypting a string derived from request parameters to authenticate identities.
API Token and API Secret through the dashboard| Param | Description | Example |
|---|---|---|
| API-Token | API Token from API management page | L35ZD3K4AORZH7NVQBR9O |
| Algorithm | Encryption algorithm (supported: HMAC-SHA256, HMAC-SHA3_256) | HMAC-SHA256 |
| Date | Current timestamp in ISO-8601 format | 2024-06-17T00:00:00Z |
| Body-MD5 | MD5 hash value of the non-GET request body (empty if absent). | a4e00bea676896c4524f112fd0e2f6b6 |
| Signature | Base64-encoded signature information (calculated using a hash algorithm). | Please refer to the following Signature for the rule of generating. |
public_key and secret_key after enabling the signature authentication feature| Description | Example | |
|---|---|---|
| algorithm | Encryption algorithm (supported: HMAC-SHA256, HMAC-SHA3_256) | HMAC-SHA256 |
| date | Current timestamp in ISO-8601 format | 2024-06-17T00:00:00Z |
| request_info | HTTP method (uppercase), path, and request parameters (excluding domain). | GET /test/logs?size=20&page=2 |
| body_md5 | MD5 hash value of the non-GET request body (empty if absent). | a4e00bea676896c4524f112fd0e2f6b6 |
Signature parameter involves these steps:signature_origin:signature_origin is formed by concatenating the following parameters using | as the delimiter: {algorithm} | {date} | {request_info} | {body_md5}HMAC-SHA256 | 2024-06-17T00:00:00Z | GET /test/logs?size=20&page=2body_md5 is absent: HMAC-SHA256 | 2024-06-17T00:00:00Z | POST /test/logs | a4e00bea676896c4524f112fd0e2f6b6signature_sha:signature_sha using HMAC-SHA256 with secret_key:signature_sha=hmac-sha256(signature_origin, secret_key)signature_sha:signature_sha using base64 to obtain the final signature:signature parameter.When API gateway signature verification fails, the server returns the original signing information. Users can compare it with their local signing information to identify the issue.
signature_origin:signature_origin.signature_origin.secret_key:secret_key used for signing on both the client and server sides is correct and identical.secret_key.signature_origin, secret_key, or another part of the process.signature_sha are correctly base64 encoded.signature_origin, signature_sha, and the final signature.