Employee Identity (EIAM)
WeChat Mini Program Login API
# Request Description
POST https://{your_domain}/api/v2/sdk/login/wechat-miniprogram
# Request Headers
| Parameter Name | Chinese Name | Required | Type | Example |
|---|---|---|---|---|
| X-operating-sys-version | Caller Client Operating System 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 | For internationalization language setting | No | String | zh |
| X-client-id | Application Authorization ID | Yes | String | nTo1eRIub60vPb54WeE6aojPwYwImtl4 |
| content-type | Content Format Type | Yes | String | application/json |
# Request Example
{
"code":" 091zQTFa1i6qMC02AWFa1Vzt0O0zQTF8"
}
1
2
3
2
3
# Request Parameters
| Parameter | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| code | WeChat Mini Program Login Code | Yes | String | The login code returned by the WeChat Mini Program login. |
# Response Example
Success Example 1 (Successfully matched user, returns session_token, id_token):
HTTP/1.1 200 OK
Content-Type: application/json
{
"session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
"expire": 432000,
"status": "SUCCESS",
"id_token": "eyJraWQn0.eyJpc3MiOiJodHR…g1A7jG8O0uw"
}
Success Example 2 (Returns auto-registration and binding process):
HTTP/1.1 200 OK
Content-Type: application/json
{
"state_token": "eyJhbGcCJ9.eyJzdWMCJ9…tL2VPS8",
"data": "{\"socialBindOrRegisterFlow\":[\"VERIFY_PHONE\",\"VERIFY_EMAIL\"]}",
"status": "USER_REGISTER"
}
Success Example 3 (Returns binding process):
HTTP/1.1 200 OK
Content-Type: application/json
{
"state_token": " eyJhbGcCJ9.eyJzdWMCJ9…tL2VPS8",
"data": "{\"socialBindOrRegisterFlow\":[\"VERIFY_PHONE\",\"VERIFY_EMAIL\"]}",
"status": " SOCIAL_BIND"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Response Parameters
| Parameter | Chinese Name | Type | Description |
|---|---|---|---|
| status | Login Process Status Identifier | String | SUCCESS: Login successful SOCIAL_BIND: Binding process. You can choose one of the following methods to bind a user: Bind User via WeChat Authorized Phone; Bind User via Other Phone; Bind User via Username and Password. USER_REGISTER: Binding or Registration process. You can choose one of the following methods to bind or register a user: Bind or Register User via WeChat Authorized Phone; Bind or Register User via Other Phone. 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 | A token with state, used for binding the WeChat openid to the user's phone number or username process |
| data | Return Description | String | Configuration information for the tenant's social registration and binding process. The content of the socialBindOrRegisterFlow field represents the verification methods supported by the tenant. VERIFY_PHONE:Phone 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. Please refer to 《Get User Information Based on id_token》 to obtain user information. The token validity period is 5 minutes by default. |
