Instant Messaging
Server
Getting Started
Limits
Platform Service
Webhooks
Overview
Message-related Callback
Related Callbacks of User Information
Related Callbacks of Advanced Team
Related Callbacks of Super Team
Related Callbacks of Audio and Video
Callback related to Log in
Data Sync
Data Sync Overview
Activate Data Sync
IM Session Message Delivery
Other IM Message Delivery
Audio/video/whiteboard Duration Message Delivery
Content Moderation
Overview
Best Practice
API Reference
Overview
Status Code
Account Management
Register Accounts
Refresh Token
Ban Accounts
Mute Accounts
Push Notification
Login Authentication
Messaging
Send Messages
Unsend Messages
Send Broadcast Messages
Upload Files
Delete a message
Delete a roaming message
Message history
History
Custom system notification
User Profile
User Relationship
Host User Relationship
Group
Advanced group
Supergroup
Chat room
Create a chat room
Get the URL of a chat room
Update chat room info
Edit chat room states
Set a timer to close a chat room
Manage roles
Get the member list
Manage chatbots
Manage tags
Message queues
Online Status

Refresh Token

Update time: 2022/11/25 16:06:51

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

POST 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)

curl -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

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

Error response

"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

POST 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)

curl -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

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

Error response

"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 topic 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