What is the purpose of the Token Authentication API?
The Token Authentication API generates secure access tokens for authenticating requests to other ADVANCE APIs.
How do I generate an access token?
-
Obtain your accessKey and secretKey from the Websaas Platform.
-
Create a SHA256-encrypted signature combining your accessKey, secretKey, and a 13-digit timestamp.
-
Make a POST request to
https://api.advance.ai/openapi/auth/ticket/v1/generate-tokenwith the following parameters:-
accessKey: Your access key
-
timestamp: Current timestamp (within 300 seconds of server time)
-
signature: The SHA256-encrypted string
-
periodSecond (optional): Validity period of the token (default: 3600 seconds)
-
What does a successful response look like?
{
"code": "SUCCESS",
"message": "OK",
"data": {
"token": "eyJhbGciOiJIUzUxMiJ9...",
"expiredTime": 1642580192430
},
"transactionId": "6c2c50a3049ce67e",
"pricingStrategy": "FREE"
}
What errors might occur during token generation?
-
PARAMETER_ERROR: Ensure parameters likeaccessKey,timestamp, orsignatureare correct. -
ACCOUNT_DISABLED: Contact support if your account is disabled. -
CLIENT_ERROR: Check the request format and parameters.
What are the key best practices for token management?
-
Always use the latest token for API requests.
-
Re-generate tokens before the current token expires.
-
Securely store your accessKey and secretKey to avoid unauthorized access.
Comments
0 comments