get_admin_token
Brief Description
- Retrieve the token for the APP administrator.
⚠️ Note: OpenIM Server has a built-in APP administrator with the userID
set as imAdmin
.
Request Method
POST
Request URL
{API_ADDRESS}/auth/get_admin_token
Header
Header Name | Example Value | Required | Type | Description |
---|---|---|---|---|
operationID | 1646445464564 | Required | string | Used for global traceability. It is recommended to use a timestamp, with a unique value for each request. |
Request Parameter Example
{
"secret": "openIM123",
"userID": "imAdmin"
}
Field Name | Required | Type | Description |
---|---|---|---|
secret | Required | string | OpenIM secret, found in config/share.yaml under secret , the default is openIM123 . |
userID | Required | string | APP administrator ID, which is imAdmin . |
Success Response Example
{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJvcGVuSU1BZG1pbiIsIlBsYXRmb3JtSUQiOjEsImV4cCI6MTY5Njc1NDgwNSwibmJmIjoxNjg4OTc4NTA1LCJpYXQiOjE2ODg5Nzg4MDV9.SAu86X3PzfYjtjBeYA4vZefNr1IiFKRgg12FeiXSm14",
"expireTimeSeconds": 7776000
}
}
Success Response Parameter Description
Parameter Name | Type | Description |
---|---|---|
errCode | int | Error code, 0 indicates success |
errMsg | string | Brief error message, empty if successful |
errDlt | string | Detailed error message, empty if successful |
data | object | Common data object, structure detailed below |
token | string | The retrieved user token |
expireTimeSeconds | string | Token expiration time (in seconds) |
Failure Response Example
{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}
Failure Response Parameter Description
Parameter Name | Type | Description |
---|---|---|
errCode | int | Error code, see the global error code document for details |
errMsg | string | Brief error message |
errDlt | string | Detailed error message |