Customer Identity (CIAM)

WeChat Mini Program Login

Call this interface when using WeChat Mini Program login.

# Request Specification

POST https://{your_domain}/api/v2/sdk/login/wechat-miniprogram

# Request Headers

Parameter Name Chinese Name Required Type Example
X-operating-sys-version Calling Client Operating System Version Yes String windows10.1.1
X-device-fingerprint Calling Client Device Fingerprint Yes String 156aysdna213sc50
X-device-ip Calling 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

# Request Parameters

Parameter Name Chinese 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 (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-register and bind flow):
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 bind flow):
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

# Response Parameters

Parameter Name Chinese Name Type Description
status Login Flow Status Identifier String SUCCESS: Login successful
SOCIAL_BIND: Bind flow. Choose one method to bind:
Bind User via WeChat Authorized Mobile;
Bind User via Other Mobile;
Bind User via Username and Password
USER_REGISTER: Bind or Register flow. Choose one method to bind/register:
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 A token with state, used for the flow of binding WeChat's openid to a user's mobile number or username
data Return description String Configuration information for the tenant's social registration/binding flow. 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-lived String This field is in JWT format and contains user identity information. Refer to Get User Information from id_token to obtain user information. The token's validity period defaults to 5 minutes.