Skip to main content

Obtain a regular user token

Brief Description

  • Administrators can obtain user tokens.

⚠️ Note: OpenIMServer has a built-in app administrator, whose userID is imAdmin.

Request Method

  • post

Request URL

  • http://x.x.x.x:10002/auth/get_user_token
Header NameExample ValueOptionalTypeDescription
operationID1646445464564RequiredstringoperationID is used for global link tracking
tokeneyJhbxxxx3XsRequiredstringAdministrator token

Request Example

{
"platformID": 1,
"userID": "111111"
}
Field NameOptionalTypeExplanation
platformIDRequiredintPlatform ID, 1: iOS, 2: Android, 3: Windows, 4: OSX, 5: Web, 6: MiniWeb, 7: Linux, 8: Android Pad, 9: iPad, 10: admin
userIDRequiredstringUser ID

Successful Return Example

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

Explanation of Parameters in Successful Return

Parameter NameTypeExplanation
errCodeintError code, 0 indicates success
errMsgstringBrief error message, empty if there is no error
errDlterrDltDetailed error message, empty if there is no error
dataobjectGeneral data object, specific structure shown below
tokenstringObtained user token
expireTimeSecondsstringToken expiration time (in seconds)

Failed Return Example

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

Explanation of Parameters in Failed Return

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