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 |
| content-type | Content Format Type | Yes | String | application/json |
Request Example
json
{
"code":" 091zQTFa1i6qMC02AWFa1Vzt0O0zQTF8"
}Request Parameters
| Parameter Name | Name | Required | Type | Description |
|---|---|---|---|---|
| code | WeChat Mini Program Login Code | Yes | String | Login code returned by WeChat Mini Program login |
Response Example
Success Example 1 (User Successfully Matched; Returns session_token and id_token)
HTTP/1.1 200 OK
json
{
"session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
"expire": 432000,
"status": "SUCCESS",
"id_token": "eyJraWQn0.eyJpc3MiOiJodHR…g1A7jG8O0uw"
}Success Example 2 (Returns Auto-Register and Bind Flow)
HTTP/1.1 200 OK
json
{
"state_token": "eyJhbGcCJ9.eyJzdWMCJ9…tL2VPS8",
"data": "{\"socialBindOrRegisterFlow\":[\"VERIFY_PHONE\",\"VERIFY_EMAIL\"]}",
"status": "USER_REGISTER"
}Success Example 3 (Returns Bind Flow)
HTTP/1.1 200 OK
json
{
"state_token": " eyJhbGcCJ9.eyJzdWMCJ9…tL2VPS8",
"data": "{\"socialBindOrRegisterFlow\":[\"VERIFY_PHONE\",\"VERIFY_EMAIL\"]}",
"status": " SOCIAL_BIND"
}Response Parameters
| Parameter Name | Name | Type | Description |
|---|---|---|---|
| status | Login Flow Status Identifier | String | SUCCESS: Login successful SOCIAL_BIND: Bind flow. You can choose one of the following ways to bind a user: Bind User via WeChat Authorized Mobile; Bind User via Mobile or Email; Bind User via Username and Password. USER_REGISTER: Bind or register flow. You can choose one of the following ways to bind or register a user: Bind or Register User via WeChat Authorized Mobile; Bind or Register User via Other Mobile. 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 |
| state_token | Login State Token | String | Token with state, used for binding WeChat openid to the user's mobile number or username flow |
| data | Return Description | String | Tenant social registration and binding flow configuration information. The socialBindOrRegisterFlow field contains the verification methods supported by the tenant.VERIFY_PHONE: Mobile number + SMS verification code VERIFY_EMAIL: Email + email verification code |
| 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. |