Skip to main content

Get APP Admin Token

Brief Description

  • Use secret to get APP admin token for other REST APIs to use

⚠️ Note: IMServer has a built-in APP admin, its userID is imAdmin

Request Method

  • post

Request URL

  • {API_ADDRESS}/auth/get_admin_token
Header NameExample ValueOptionalTypeDescription
operationID1646445464564RequiredstringUsed for global link tracking, timestamp is recommended, independent in each request

Request Parameter Example

{
"secret": "openIM123",
"userID": "imAdmin"
}
Field NameOptionalTypeDescription
secretRequiredstringSecret key, secret field in config/share.yaml
userIDRequiredstringAPP admin ID, default is imAdmin

Success Return Example

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

Parameter Description for Success Return Example

Parameter NameTypeDescription
errCodeintError code, 0 means success
errMsgstringBrief error message, empty on success
errDlterrDltDetailed error message, empty on success
dataobjectGeneral data object, see structure below
tokenstringAPP admin token
expireTimeSecondsstringToken expiration time (in seconds)

Failure Return Example

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

Parameter Description for Failure Return Example

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