User Registration
To establish a connection with RC servers, clients must provide a user authentication Token. This Token serves as the unique identifier for users within RC services, required for both RC Chat and RTC functionalities. Obtaining a Token signifies user registration completion in RC services.
Obtaining a Token
Client SDKs do not provide APIs for Token retrieval. You must integrate RC's server-side Token API into your application server to implement this logic.
Upon successful Token acquisition, your App Server distributes it to clients for connecting to RC services. Tokens remain valid until expiration. The same user ID can obtain multiple Tokens; all unexpired Tokens remain usable for connections.
Refreshing your App Secret in the Console immediately invalidates all existing Tokens under the App Key. Regenerate API signatures with the new App Secret and obtain fresh Tokens.
Request Method
Exchange an app-defined user ID (userId
) for an RC authentication Token. Use the same endpoint for Token renewal.
POST: https://data center domain/user/getToken.json
Signature Rule: All RC server API requests require validation. See API Request Signing.
Rate Limit: 200 requests per second
Input Parameters
The name
and portraitUri
parameters provided during Token retrieval are exclusively for mobile push notifications. For profile updates, use the Update User Info method. New values in subsequent Token requests overwrite existing data.
Parameter | Type | Required | Description |
---|---|---|---|
userId | String | Yes | App-defined user ID for Token exchange. Supports alphanumeric characters (case-sensitive), max 64 bytes. |
name | String | Yes | Display name for push notifications (max 64 chars). Note: This field is solely for RC's push service. RC does not host user profiles, so client SDKs cannot retrieve this data. |
portraitUri | String | No | User avatar URI (max 1024 bytes). Note: RC does not host user profiles, so client SDKs cannot retrieve this data. |
- In one-to-one chat, messages can be routed using only the
userId
. For security, avoid sequential user IDs to prevent misuse. - Legacy Server SDK versions may require
portraitUri
. To omit this field, either upgrade to the latest SDK or provide a placeholder (e.g., "_").
Request Example
POST /user/getToken.json HTTP/1.1
Host: api-cn.ronghub.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/x-www-form-urlencoded
userId=jlk456j5&name=Ironman&portraitUri=http%3A%2F%2Fabc.com%2Fmyportrait.jpg
Response
Field | Type | Description |
---|---|---|
code | Int | Status code (200 = success). |
token | String | Authentication Token (≤256 bytes). Contains dynamic IM navigation addresses—no developer processing needed. |
userId | String | Echoes the input user ID. |
Response Example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{"code":200, "userId":"jlk456j5", "token":"sfd9823ihufi"}
Using Tokens
RC does not manage App user data. Registration simply requires exchanging a user ID for a Token.
Your client app must handle Token expiration during IM connections by requesting new Tokens from your App Server when needed.