WeChat Mini Program Mobile Number Login
Call this API when logging in with a WeChat Mini Program authorized mobile number. Note that the Mini Program version must be above 2.21.2 when calling this API.
Request Description
POST https://{your_domain}/api/v2/sdk/login/wechat-mini-program-mobile
Request Headers
| Parameter Name | Name | Required | Type | Example |
|---|---|---|---|---|
| X-operating-sys-version | Caller client OS version | Yes | String | windows10.1.1 |
| X-device-fingerprint | Caller client device fingerprint | Yes | String | 156aysdna213sc50 |
| X-device-ip | Caller 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 international language settings | No | String | zh |
| X-client-id | Application authorization ID | Yes | String | nTo1eRIub60vPb54WeE6aojPwYwImtl4 |
| content-type | Content format type | Yes | String | application/json |
Request Example
json
{
"code":" 6082b2e9bb01b3b734b1a1a1ff8d3f0f35340ef23bff7d71cdb4d2d45b637c4e"
}Request Parameters
| Parameter Name | Name | Required | Type | Description |
|---|---|---|---|---|
| code | WeChat Mini Program mobile number authorization code | Yes | String | Authorization code returned by WeChat Mini Program mobile number authorization |
Response Examples
Success Example (Successful user match returns session_token and id_token)
HTTP/1.1 200 OK
json
{
"session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
"expire": 432000,
"status": "SUCCESS",
"id_token": "eyJraWQn0.eyJpc3MiOiJodHR…g1A7jG8O0uw"
}Response Parameters
| Parameter Name | Name | Type | Description |
|---|---|---|---|
| status | Login flow status identifier | String | SUCCES: Login successful |
| expire | session_token validity period | Number | session_token validity period |
| session_token | User session_token | String | User session_token |
| id_token | Identity token of logged-in user, short-term valid | String | This field is in JWT format and contains user identity information. You can refer to Get User Info from id_token to obtain user information. The token validity period defaults to 5 minutes. |