提交工单
咨询集成、功能及报价等问题
The access_token is the globally unique credential of the interface, and the access party needs to use it when calling each interface. The access_token is valid for 2 hours, and needs to be refreshed regularly and stored properly.
Request method: POST/JSON
Request endpoint:
Service Environment | Call Frequency Limit | Endpoint |
---|---|---|
Test environment | 10 times/sec | https://docservice-test.zego.im/cgi/token |
Formal environment | 10 times/sec | https://docservice.zego.im/cgi/token |
Transmission protocol: HTTPS
Parameters | Type | Required | Description |
---|---|---|---|
app_id | Int64 | Yes | AppID assigned by ZEGO to developers, which uniquely identifies an application. |
seq | Int64 | Yes | Protocol sequence number, incremented by 1 every time it is requested. |
token | String | Yes | ZEGO background service authentication certificate. |
version | Int | Yes | Protocol version number, filled with 1 by default. |
Token generation rule description:
tokenInfo ='{
"ver": 1,
"hash": "0800fc577294c34e0b28ad2839435945",
"nonce": "0123456789ABCDEF",
"expired": 1592028898 // Unit: seconds
}'
// Note that JSON must be constructed first, and then converted into a string
token = base64(tokenInfo)
Among them, tokenInfo is a string in JSON format, and the fields in tokenInfo are described as follows:
Parameters | Type | Description |
---|---|---|
ver | Int | Version number, fill in 1 by default. |
hash | String | hash = md5sum(sprintf("%u%s%s%u",app_id,server_app_secret,nonce,expired)); The final result of md5sum is a 32-byte lowercase hex encoded string. |
nonce | String | Random string with a length of 16 bytes. |
expired | Int64 | token expiration time, Unix timestamp, unit: second. |
The description of the rules for generating the hash field in tokenInfo:
Parameters | Type | Description |
---|---|---|
app_id | Int64 | App unique identification. |
server_app_secret | String | ServerSecret App unique credential key, the length is 16 bytes, please obtain it from ZEGO Management Console. |
{
"version": 1,
"seq": 1,
"app_id": 0000,
"token": "TOKEN"
}
Parameters | Type | Description |
---|---|---|
code | Int | Error code. |
message | String | Error description. |
data | JSON Object | token information. |
The data members are as follows:
Parameters | Type | Description |
---|---|---|
access_token | String | The obtained certificate. |
expires_in | Int64 | The valid time of the certificate, in seconds. |
{
{
"ret": {
"code": 0,
"message": "succeed"
},
"data": {
"access_token": "c205dytwQTd4ZlZjSjBLTXY0V3FzYUtBY1Q9ZEo0eGFJcEt3WVBKSlFGeXh5aGZITjJWYnlBcT0",
"expires_in": 7200
}
}