Customer Identity (CIAM)
Username + Password Login
During the call to the username and password login interface, different results are returned based on the configuration. A successful normal call returns the user's session_token. If password expiration check is enabled, a state_token is returned. A failed call returns failure information.
# Request Description
POST https://{your_domain}/api/v2/sdk/login
# 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
{
"user_name":"test01",
"password":"123456"
}
1
2
3
4
2
3
4
# Request Parameters
| Parameter Name | Chinese Name | Required | Type | Description |
|---|---|---|---|---|
| user_name | Username | Yes | String | Username |
| password | Password | Yes | String | Password |
# Response Example
Success Example 1 (Returns session_token upon successful user match):
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 password nearing expiration workflow):
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "PASSWORD_WARN",
"state_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"data": "{\"maxLength\":18,\"minLength\":8,\"regEx\":\"^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]+$)(?![a-z0-9]+$)(?![a-z~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]+$)(?![0-9~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]+$)[a-zA-Z0-9~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]{1,}$\",\"tip\":\"至少包含数字、大写字母、小写字母和特殊字符中的3种\"}"
}
Success Example 3 (Returns password expired workflow):
HTTP/1.1 200 OK
Content-Type: application/json
{
"status": "PASSWORD_EXPIRED",
"state_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
"data": "{\"maxLength\":18,\"minLength\":8,\"regEx\":\"^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]+$)(?![a-z0-9]+$)(?![a-z~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]+$)(?![0-9~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]+$)[a-zA-Z0-9~!#$%&+\\\\-,*:;<=>@_?^、`~\\\\./]{1,}$\",\"tip\":\"至少包含数字、大写字母、小写字母和特殊字符中的3种\"}"
}
Error Example:
HTTP/1.1 400 Bad Request
{
"error_code": "IDAAS.SDK.LOGIN.0002",
"error_msg": "Invalid account or password. Remaining times: 9"
}
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
# Return Parameters
| Parameter Name | Chinese Name | Type | Description |
|---|---|---|---|
| status | Login Process Status Identifier | String | Possible values for this field are: SUCCESS Login successful PASSWORD_WARN Password about to expire PASSWORD_EXPIRED Password expired ACCESS_DENIED Access denied |
| expire | session_token Validity Period | Number | Session_token validity period, ticket can be obtained using session_token within the validity period |
| session_token | User session_token | String | User session_token, this token can be used to call IDaaS APIs to obtain a new id_token |
| state_token | User Stateful Token | String | User Stateful Token |
| data | Return Description | String | Return Description |
| id_token | Short-term valid, API call token | String | This field is in JWT format and contains user identity information. Refer to Obtaining User Information from id_token to get user information. Token validity period defaults to 5 minutes and is configurable. |
# Error Codes
| Status Code | Error Code | Error Message | Handling Measure |
|---|---|---|---|
| 400 | IDAAS.SDK.PARAM.0001 | Device information is incomplete | Please check if the input device information is complete |
| Device information is incomplete | |||
| 400 | IDAAS.SDK.PARAM.0002 | clientId cannot be empty | Please check if the input clientId is empty |
| clientId cannot be empty | |||
| 400 | IDAAS.SDK.PARAM.0003 | The app is not registered, please register the app first | Please check if the input clientId is correct |
| The app is not registered, please register the app first | |||
| 400 | IDAAS.SDK.USER.0002 | Username cannot be empty | Please check if the input username is empty |
| Username cannot be empty | |||
| 400 | IDAAS.SDK.USER.0006 | Password cannot be empty | Please check if the input password is empty |
| Password cannot be empty | |||
| 400 | IDAAS.SDK.LOGIN.0001 | User has been locked out due to multiple login failures. It will be unlocked in {0} minutes and {1} seconds | Please unlock and try again |
| User has been locked out due to multiple login failures. It will be unlocked in {0} minutes and {1} seconds | |||
| 400 | IDAAS.SDK.LOGIN.0002 | Invalid account or password. Remaining times: {0} | Please check if the input username or password is correct |
| Invalid account or password. Remaining times: {0} | |||
| 500 | IDAAS.SDK.COM.0002 | System busy, please try again later | Please retry or contact Zhuyun staff |
| System busy, please try again later | |||
| 400 | IDAAS.SDK.USER.0039 | User is disabled | Please contact the administrator |
| User is disabled |
