Skip to main content

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 NameExample ValueRequiredTypeDescription
operationID1646445464564RequiredstringUsed 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 NameRequiredTypeDescription
secretRequiredstringOpenIM secret, found in config/share.yaml under secret, the default is openIM123.
userIDRequiredstringAPP administrator ID, which is imAdmin.

Success Response Example

{
"errCode": 0,
"errMsg": "",
"errDlt": "",
"data": {
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJvcGVuSU1BZG1pbiIsIlBsYXRmb3JtSUQiOjEsImV4cCI6MTY5Njc1NDgwNSwibmJmIjoxNjg4OTc4NTA1LCJpYXQiOjE2ODg5Nzg4MDV9.SAu86X3PzfYjtjBeYA4vZefNr1IiFKRgg12FeiXSm14",
"expireTimeSeconds": 7776000
}
}

Success Response Parameter Description

Parameter NameTypeDescription
errCodeintError code, 0 indicates success
errMsgstringBrief error message, empty if successful
errDltstringDetailed error message, empty if successful
dataobjectCommon data object, structure detailed below
tokenstringThe retrieved user token
expireTimeSecondsstringToken expiration time (in seconds)

Failure Response Example

{
"errCode": 1004,
"errMsg": "RecordNotFoundError",
"errDlt": ": [1004]RecordNotFoundError"
}

Failure Response Parameter Description

Parameter NameTypeDescription
errCodeintError code, see the global error code document for details
errMsgstringBrief error message
errDltstringDetailed error message