Skip to main content
POST
/
user
/
token
curl -X POST "http://localhost:5001/user/token" \
  -H "Content-Type: application/json" \
  -d '{
    "uid": "user123",
    "token": "new_auth_token_here",
    "device_flag": 1,
    "device_level": 1
  }'
{
  "status": "ok"
}

Overview

Update user authentication token, used for user re-login or token refresh scenarios.

Request Body

Required Parameters

uid
string
required
Unique user ID for communication, can be random uuid (recommended to use your server’s unique user uid) (required by WuKongIMSDK)
token
string
required
Verification token, random uuid (recommended to use your server’s user token) (required by WuKongIMSDK)
device_flag
integer
required
Device identifier: 0=app, 1=web, 2=desktop (main devices with same user and same device flag will kick each other, secondary devices will coexist)

Optional Parameters

device_level
integer
Device level: 0=secondary device, 1=main device
curl -X POST "http://localhost:5001/user/token" \
  -H "Content-Type: application/json" \
  -d '{
    "uid": "user123",
    "token": "new_auth_token_here",
    "device_flag": 1,
    "device_level": 1
  }'
{
  "status": "ok"
}

Response Fields

status
string
required
Operation status, returns "ok" on success

Status Codes

Status CodeDescription
200Token updated successfully
400Request parameter error
500Internal server error

Best Practices

  1. Token Security: Ensure tokens have sufficient complexity and uniqueness
  2. Device Identification: Properly set device_flag to distinguish different device types
  3. Permission Control: Use device_level to implement permission control for different devices
  4. Regular Refresh: Implement regular token refresh mechanism
  5. Multi-device Management: Generate different tokens for different devices for easier management and revocation