Refresh Token

Update time: 2023/05/05 06:34:25

Refreshing a specified token

This API is used to update the user account to the specified token. If you update the specified token, you must also update the token managed on the app server. Make sure that the client uses the updated token for login.

Request URL

httpPOST https://api-sg.netease.im/nimserver/user/update.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

Request parameters

  • For information about headers in the POST request, see Overview.

  • The POST request body contains the following parameters:

Parameter Type String upper limit Required Example Description
accid String 32 Yes "123456" The CommsEase account whose token requires refreshing.
props String 1024 Optional {"k":"v"} Ignore this parameter.
token String 128 Optional "abcdef" New token

Example

Request example (curl)

curlcurl -X POST -H "AppKey: go9dnk4***9jd9vmel1kglw0803mgq3" -H "Nonce: 4tgggergigw***3t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962cf***f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan&token=123456' 'https://api-sg.netease.im/nimserver/user/update.action'

Success response

json"Content-Type": "application/json; charset=utf-8"
{
    "code": 200
}

Error response

json"Content-Type": "application/json; charset=utf-8"
{
    "code": 414,
    "desc": "Jack is not registered"
}

Refreshing an unspecified token

This API is used to update the user account to a token randomly generated by CommsEase Server. If you update an unspecified token, you must also update the token managed on the app server. Make sure that the client uses the latest token for login.

Request URL

httpPOST https://api-sg.netease.im/nimserver/user/refreshToken.action HTTP/1.1
Content-Type:application/x-www-form-urlencoded;charset=utf-8

Request parameters

  • For information about headers in the POST request, see Overview.

  • The POST request body contains the following parameters:

Parameter Type String upper limit Required Example Description
accid String 32 Yes "123456" The CommsEase account whose token requires refreshing.

Example

Request example (curl)

curlcurl -X POST -H "AppKey: go9dnk49bkd9jd9v***1kglw0803mgq3" -H "Nonce: 4tgggergig***323t23t" -H "CurTime: 1443592222" -H "CheckSum: 9e9db3b6c9abb2e1962c***6f7316fcc55583f86" -H "Content-Type: application/x-www-form-urlencoded" -d 'accid=zhangsan' 'https://api-sg.netease.im/nimserver/user/refreshToken.action'

Success response

json"Content-Type": "application/json; charset=utf-8"
{
    "code": 200
}

Error response

json"Content-Type": "application/json; charset=utf-8"
{
    "code": 414,
    "desc": "Jack is not registered"
}

Error codes

Error codes may be returned in the body of HTTP responses. For more information, see Error codes.

Was this page helpful?
Yes
No
  • Refreshing a specified token
  • Request URL
  • Request parameters
  • Example
  • Request example (curl)
  • Success response
  • Error response
  • Refreshing an unspecified token
  • Request URL
  • Request parameters
  • Example
  • Request example (curl)
  • Success response
  • Error response
  • Error codes