Bind User via WeChat Authorized Mobile Interface
Call this interface when using a WeChat mobile number to bind a platform user. Before calling this interface, you need to obtain a temporary token through the WeChat Mini Program Login Interface.
Request Description
Request Headers
| Parameter Name | Name | Required | Type | Example |
|---|---|---|---|---|
| X-operating-sys-version | Client Operating System Version | Yes | String | windows10.1.1 |
| X-device-fingerprint | Client Device Fingerprint | Yes | String | 156aysdna213sc50 |
| X-device-ip | Client IP | No | String | 192.168.1.2 |
| X-agent | User-Agent Information | Yes | String | Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X) |
| X-L | Used for Internationalization Language Settings | No | String | zh |
| X-client-id | Application Authorization ID | Yes | String | nTo1eRIub60vPb54WeE6aojPwYwImtl4 |
| X-state-token | Temporary Token | Yes | String | eyJhbcOiJ……nEPRiIC4we0 |
| content-type | Content Format Type | Yes | String | application/json |
Request Example
json
{
"wechat_code":"6213b8e364d3f0eaf7cf196bfe49675553b4919d6e664b70d5eaa6cbf8531afe"
}Request Parameters
| Parameter Name | Name | Required | Type | Description |
|---|---|---|---|---|
| wechat_code | WeChat Mobile Authorization Code | Yes | String | Authorization code returned by the WeChat Mini Program after the user authorizes the WeChat mobile authorization popup launched by the Mini Program |
Response Example
Success Example
HTTP/1.1 200 OK
json
{
"session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
"expire": 432000,
"status": "SUCCESS",
"id_token": "eyJraWQn0.eyJpc3MiOiJodHR…g1A7jG8O0uw"
}Error Example
HTTP/1.1 400 Bad Request
json
{
"error_code": "IDAAS.SDK.COMMON.1007",
"error_msg": "state_token parameter error"
}Response Parameters
| Parameter Name | Name | Type | Description |
|---|---|---|---|
| status | Login Flow Status Identifier | String | SUCCESS: Login successful SOCIAL_BIND: Bind flow USER_REGISTER: Auto-register and bind flow ACCESS_DENIED: Access denied MFA_AUTH: Secondary authentication |
| expire | session_token Validity Period | Number | session_token validity period |
| session_token | User session_token | String | User session_token |
| id_token | Identity Token of the Logged-in User, Short-term Valid | String | This field is in JWT format and contains user identity information. You can refer to "Get User Information from id_token" to obtain user information. The token validity period defaults to 5 minutes. |