Customer Identity (CIAM)
Apple Login
During the Apple login interface call, different results are returned based on configuration. A successful normal call returns the user's session_token, an unbound state returns a state_token, and a failure returns failure information.
# Request Description
POST https://{your_domain}/api/v2/sdk/login/apple
# Request Headers
| Parameter Name | Chinese Name | Required | Type | Example |
|---|---|---|---|---|
| X-operating-sys-version | Calling Client OS 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 {/examples/}
{
"code":"ad12sasdsfe3dfdg3sc"
}
1
2
3
2
3
# Request Parameters {/examples/}
| Parameter Name | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| code | Apple Authorization Code | Yes | String | Authorization code [The authorization code provided by Apple when the app launches] |
# Response Example {/examples/}
Success Example 1 (Returns session_token for successfully matched user):
HTTP/1.1 200 OK
Content-Type: application/json
{
"session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
"expire": 432000,
"status": "SUCCESS",
"id_token": "eyJ0NiJ9.eyJ1cI6IjIifX0.DeWt4QuZXso"
}
Success Example 2 (Returns auto-register and bind flow):
HTTP/1.1 200 OK
Content-Type: application/json
{
"state_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"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": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"data": "{\"socialBindOrRegisterFlow\":[\"VERIFY_PHONE\",\"VERIFY_EMAIL\"]}",
"status": " SOCIAL_BIND"
}
Error Example:
HTTP/1.1 400 Bad Request
{
"error_code": "IDAAS.SDK.PARAM.0001",
"error_msg": "Device information is incomplete"
}
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
29
30
31
32
33
34
35
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
29
30
31
32
33
34
35
# Response Parameters {/examples/}
| Parameter Name | Chinese Name | Type | Description |
|---|---|---|---|
| status | Login Flow Status Identifier | String | Possible values for this field are: SUCCESS Login successful SOCIAL_BIND Bind flow USER_REGISTER Auto-register bind flow ACCESS_DENIED Access denied |
| expire | session_token Validity Period | Number | session_token validity period, ticket can be obtained using session_token within this period |
| session_token | User session_token | String | User session_token, this token can be used to call IDaaS interfaces to obtain a new id_token |
| state_token | User Stateful Token | String | User Stateful Token |
| id_token | Short-term valid, interface call token | String | This field is in JWT format and contains user identity information. Refer to Get User Info from id_token to obtain user information. Token validity period defaults to 5 minutes, configurable |
| data | Return Description | String | Configuration information for the tenant's social registration and binding flow. The content of the socialBindOrRegisterFlow field is the verification methods supported by the tenant. VERIFY_PHONE: Phone number + SMS verification code VERIFY_EMAIL: Email + Email verification code |
# Error Codes
| Status Code | Error Code | Error Message | Handling Action |
|---|---|---|---|
| 400 | IDAAS.SDK.PARAM.0001 | Device information is incomplete | Please check if the input device information is complete |
| 设备信息不完整 | |||
| 400 | IDAAS.SDK.PARAM.0002 | clientId cannot be empty | Please check if the input clientId is empty |
| clientId不能为空 | |||
| 400 | IDAAS.SDK.PARAM.0003 | The app is not registered, please register the app first | Please check if the input clientId is correct |
| 应用未注册,请先注册应用 | |||
| 400 | IDAAS.SDK.PARAM.0011 | Apple authorization code cannot be empty | Please check if the input Apple authorization code is empty |
| Apple授权码不能为空 | |||
| 500 | IDAAS.SDK.COM.0002 | System busy, please try again later | Please retry the call or contact Zhuyun staff |
| 系统繁忙,请稍后再试 | |||
| 400 | IDAAS.SDK.USER.0039 | User is disabled | Please contact the administrator |
| 用户已被禁用 |
