Token Authentication API
This is the API for getting the Access Token.
Request Url
https://my-api.advance.ai/openapi/auth/ticket/v1/generate-token
POST (application/json)
https://ph-api.advance.ai/openapi/auth/ticket/v1/generate-token
POST (application/json)
https://th-api.advance.ai/openapi/auth/ticket/v1/generate-token
POST (application/json)
https://api.advance.ai/openapi/auth/ticket/v1/generate-token
POST (application/json)
Request Parameters
Parameter | Description |
---|---|
accessKey | string the accessKey |
timestamp | string 13-digit-long timestamp |
signature | string Combined accessKey, secretKey and timestamp, encrypted by SHA256.eg. accessKey: sampleaccesskey secretKey: samplesecretkey timestamp: 1665993522952 Combined: sampleaccesskeysamplesecretkey1665993522952 Encrypted based on the combined: 02209bbeaf0d0a3dd587f6a1ba22f84c98d142e3b545e77db7e4906ca56349f5 |
periodSecond | string optional Validity period defaults to 3600 seconds, minimum 60 seconds, maximum 86400 seconds. Unit is seconds |
Note:
- You can find accessKey, secretKey on the Websaas Platform -> Account -> Account Management
- The timestamp in the “signature” must be consistent with parameter
timestamp
- Please remember to re-obtain a new valid token to do the authentication for the open APIs when the previous one is expired
Code Sample
curl -X POST \
-H "Content-Type: application/json" \
-d '{"accessKey":"22**70b","signature":"f786441e7b3d95f*****853a5a244f9522","timestamp":1648785145789,"periodSecond":120}' \
"https://api.advance.ai/openapi/auth/ticket/v1/generate-token"
Response Description
Parameter | Description |
---|---|
code | Response Status Code |
message | Message returned from server |
data | token AccessToken |
expiredTime Expiration timestamp | |
extra | Extra response info such as exception message |
transactionId | the request id, the max length is 64 |
pricingStrategy | Deprecated , Always return FREE |
Response Code
Status Code | Message |
---|---|
SUCCESS | OK |
PARAMETER_ERROR | Timestamp error |
Parameter should not be empty | |
Signature error | |
ACCOUNT_DISABLED | Account Disabled |
CLIENT_ERROR | HTTP 400 - Bad Request |
Response Examples
SUCCESS
{
"code":"SUCCESS",
"message":"OK",
"data":{
"token":"eyJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJoNV9saXZlbmVzcyIsInN1YiI6IntcImN1c3RvbWVySWRcIjo1NTAwMDI4MixcImFjY291bnRJZFwiOjU1MDAwMjg0LFwicmVhbElwXCI6XCI0NS4yNTEuMTA3LjExMVwifSIsImF1ZCI6IldFQiIsImlhdCI6MTY0MjU4MDA3MiwiZXhwIjoxNjQyNTgwMTkyfQ.HmIDcuSW67A59x7bnumjGp0Wdcz-FmoDrnHF1YGui6wVPfulLn4Izonay5LQnySgph1dbyC1E0LtifS-BJo8VA",
"expiredTime":1642580192430
},
"extra":null,
"transactionId":"6c2c50a3049ce67e",
"pricingStrategy":"FREE"
}
PARAMETER_ERROR
{
"code":"PARAMETER_ERROR",
"message":"Parameter should not be empty",
"data":null,
"extra":null,
"transactionId":"040e769e38f87e3e",
"pricingStrategy":"FREE"
}
{
"code":"PARAMETER_ERROR",
"message":"Timestamp error",
"data":null,
"extra":null,
"transactionId":"a9c2a6c199ad5db5",
"pricingStrategy":"FREE"
}
{
"code":"PARAMETER_ERROR",
"message":"Signature error",
"data":null,
"extra":null,
"transactionId":"00b05cb9cf6f0fed",
"pricingStrategy":"FREE"
}
ACCOUNT_DISABLED
{
"code":"ACCOUNT_DISABLED",
"message":"Account Disabled",
"data":null,
"extra":null,
"transactionId":"5e00fded1272490e",
"pricingStrategy":"FREE"
}
CLIENT_ERROR
{
"code":"CLIENT_ERROR",
"message":"HTTP 400 - Bad Request",
"data":null,
"extra":null,
"transactionId":"bd5d5653c45d4c6e",
"pricingStrategy":"FREE"
}
Updated 3 months ago