Login#
Request Parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
| op | String | Yes | Operation, login |
| args | Array | Yes | List of subscribed channels |
| > apiKey | String | Yes | API Key |
| > passphrase | String | Yes | API Key password |
| > timestamp | String | Yes | Unix Epoch time, the unit is seconds |
| > sign | String | Yes | Signature string |
Response Parameters#
| Parameter | Type | Description |
|---|---|---|
| event | String | Operation.login or error |
| code | String | Error code |
| msg | String | Error message |
| connId | String | WebSocket connection ID |
apiKey: Unique identification for invoking API. Requires users to apply one manually in the developer portal.
passphrase: API Key password
timestamp: the Unix Epoch time, the unit is seconds, e.g. 1704876947
sign: signature string, the signature algorithm is as follows:
First concatenate timestamp, method, requestPath, strings,
then use HMAC SHA256 method to encrypt the concatenated string with SecretKey,
and then perform Base64 encoding.
secretKey: The security key generated when the user applies for API Key, e.g. : 22582BD0CFF14C41EDBF1AB98506286D
Example of timestamp: const timestamp = '' + Date.now() / 1,000
Among sign example: sign=CryptoJS.enc.Base64.stringify(CryptoJS.HmacSHA256(timestamp +'GET'+'/users/self/verify', secretKey))
method: always 'GET'.
requestPath: always '/users/self/verify'
Request Example#
{
"op": "login",
"args": [{
"apiKey": "985d5b66-57ce-40fb-b714-afc0b9787083",
"passphrase": "123456",
"timestamp": "1538054050",
"sign": "7L+zFQ+CEgGu5rzCj4+BdV2/uUHGqddA9pI6ztsRRPs="
}]
}
Response Example#
Successful Response Example
{
"event": "login",
"code": "0",
"msg": "",
"connId": "a4d3ae55"
}
Failure Response Example
{
"event": "error",
"code": "60009",
"msg": "Login failed.",
"connId": "a4d3ae55"
}