Employee Identity (EIAM)

Username + Password Login API

API

During the call to the username and password login API, different results are returned based on configuration. A successful normal call will return the user's session_token. If password expiration check or two-factor authentication is enabled, it will return a state_token. A failed call will return failure information.

# Request Specification

Request URL https://{your_domain}/api/v2/sdk/login

Request Method POST

Content-Type application/json

# Request Header Parameters

Parameter Name Chinese Name Required Type Example
X-operating-sys-version Caller Operating System Version Yes String windows10.1.1
X-device-fingerprint Caller Device Fingerprint Yes String 156aysdna213sc50
X-device-ip Caller 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) AppleWebKit/605.1.15(KHTML, like Gecko)
Mobile/15E148/HuaWei-AnyOffice/2.6.1802.0010/com.huawei.cloudlink.workplace
X-L For Internationalization Language Setting No String zh
X-client-id Application Authorization ID Yes String nTo1eRIub60vPb54WeE6aojPwYwImtl4

# Request Body Example {/examples/}

{
    "user_name":"test01",
    "password":"123456"
}
1
2
3
4

# Request Parameters {/examples/}

Parameter Name Chinese Name Required Type Description
user_name Username Yes String Username
password Password Yes String Password

# Response Example {/examples/}

Success Example 1 (Returns session_token upon successful user match):
HTTP/1.1 200 OK
Content-Type: application/json
{
    "session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
    "expire": 604800,
    "status": "SUCCESS",
    "id_token": "eyJraWQiOiJrMSIsImFsZyI6IlJTMjU2In0.eyJpc3MiOiJJc3N1ZXIiLCJhdWQiOiJBdWRpZW5jZSIsImV4cCI6MTY1MzQ4NDQxMiwianRpIjoieUxSVGZXY1VkYk9PeUFpbHdZU0ZqZyIsImlhdCI6MTY1MzQ2NjQxMiwibmJmIjoxNjUzNDY2MjkyLCJzdWIiOiJzdWJqZWN0IiwiYXBpIjoie1wibmFtZVwiOlwiXCIsXCJtb2JpbGVcIjpcIis4Ni0xNTkwNzEzMjg1MlwiLFwiaWRcIjpcIjIwMjIwNDI1MTQwMTM4NTE5LUJGMUItNTI4QjA1NTFCXCIsXCJ1c2VyTmFtZVwiOlwibG91eGlcIixcImVtYWlsXCI6XCIxMUBxcS5jb21cIn0ifQ.al79knH1fKa4aT4AFr_FMjqBKu2pV_g-lKzzgHzmor5X-dHwSBUtjH38KOzjIqHvkcRMjXQuBnWmjRI7-0Djn2LuWVueaf3wRXLscCWiSDC7chjUyTRXMatYINxdvW-oSWFYGFqqbdsavLqOnvehd7ahEaTuiL9yZolvslZIkIxjxBJJu7A9Ln2sk3wf9pxXU83jIJ8ubPQBoVS-ilerTTJOKDZ9XsL2ftJsaqdTJK_mYbvKaVpLIVyHHJ2NcF6f-Al4N4kc8cgxtSgSKFDcR7Bz7dYlOcfUXCPAzJ3NZInm8UaksiWU02tvlvTRvRdoxZNnvD5vamZ5hjFc-cW5jA"
}
Success Example 2 (Returns password expiration warning flow):
HTTP/1.1 200 OK
Content-Type: application/json
{
    "status": "PASSWORD_WARN",
	"state_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJ7XCJ1c2VySWRcIjpcIjIwMjIwMjExMTY0NDUwNjk5LTE2M0QtNTVFMEI1RTRCXCIsXCJzdGF0dXNcIjpcIlBBU1NXT1JEX0VYUElSRURcIn0iLCJleHAiOjE2NDQ1NzEzNjAsImlhdCI6MTY0NDU2OTU2MCwianRpIjoiMTY0NDU2OTU2MDIwNDAifQ.WGk9GGQGmKsmo4UmCzKfiC9x1Fj0WBowdO7jEStMvB4",
	"data": "{\"maxLength\":18,\"minLength\":8,\"regEx\":\"^.{8,18}$\",\"tip\":\"密码长度在8至18之间\",\"verifyTypes\":{\"PWD\":null,\"MOBILE\":\"+86-130****1234\",\"EMAIL\":\"****@qq.com\"}}"
}
Success Example 3 (Returns password expired flow):
HTTP/1.1 200 OK
Content-Type: application/json
{
    "status": "PASSWORD_EXPIRED",
    "state_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijoie1wic3RhdGVcIjpcIlBBU1NXT1JEX1dBUk5cIixcInVzZXJJZFwiOlwiMjAyMTA3MjYxNzQwNTgxNDUtOTFCQy0xM0UwMTRBQkJcIn0iLCJpZCI6IjIwMjEwNzI2MTc0MDU4MTQ1LTkxQkMtMTNFMDE0QUJCIiwiZXhwIjoxNjI43MTkwLCJpYXQiOjEasd2Mjg4NDY1OTB9.-egHWNfNPIxNnM540_wTYMtFwB4C9ymznEPRiIC4we0",
    "data": "{\"maxLength\":18,\"minLength\":8,\"regEx\":\"^.{8,18}$\",\"tip\":\"密码长度在8至18之间\",\"verifyTypes\":{\"PWD\":null,\"MOBILE\":\"+86-130****1234\",\"EMAIL\":\"****@qq.com\"}}"
}
Success Example 4 (Returns multi-factor authentication flow):
HTTP/1.1 200 OK
Content-Type: application/json
{
    "status": "MFA_AUTH",
    "state_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijoie1wic3RhdGVcIjpcIlBBU1NXT1JEX1dBUk5cIixcInVzZXJJZFwiOlwiMjAyMTA3MjYxNzQwNTgxNDUtOTFCQy0xM0UwMTRBQkJcIn0iLCJpZCI6IjIwMjEwNzI2MTc0MDU4MTQ1LTkxQkMtMTNFMDE0QUJCIiwiZXhwIjoxNjI43MTkwLCJpYXQiOjEasd2Mjg4NDY1OTB9.-egHWNfNPIxNnM540_wTYMtFwB4C9ymznEPRiIC4we0",
    "data": "[\"SMS\",\"EMAIL\"]"
}
Success Example 5 (Returns access denied flow):
HTTP/1.1 200 OK
Content-Type: application/json
{
    "status": "ACCESS_DENIED",
    "state_token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0Ijoie1wic3RhdGVcIjpcIlBBU1NXT1JEX1dBUk5cIixcInVzZXJJZFwiOlwiMjAyMTA3MjYxNzQwNTgxNDUtOTFCQy0xM0UwMTRBQkJcIn0iLCJpZCI6IjIwMjEwNzI2MTc0MDU4MTQ1LTkxQkMtMTNFMDE0QUJCIiwiZXhwIjoxNjI43MTkwLCJpYXQiOjEasd2Mjg4NDY1OTB9.-egHWNfNPIxNnM540_wTYMtFwB4C9ymznEPRiIC4we0",
    "data": "拒绝访问"
}
Error Example:
HTTP/1.1 400 Bad Request
{
    "error_code": "SDK.COMMON.1001",
    "error_msg": "Parameter X-client-id cannot be left blank."
}
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
36
37
38
39
40
41
42
43
44
45
46
47

# Return Parameters

Parameter Name Chinese Name Type Description
status Login Process Status Identifier String Possible return values for this field:
  • SUCCESS = Login successful
  • PASSWORD_WARN = Password about to expire
  • PASSWORD_EXPIRED = Password expired
  • MFA_AUTH = Secondary authentication
  • ACCESS_DENIED = Access denied
  • expire session_token Validity Period Number session_token validity period, within which session_token can be used to obtain a ticket
    session_token User session_token String User session_token, which can be used to call IDaaS interfaces to obtain a ticket; the ticket can be exchanged for user information
    state_token User Stateful Token String User stateful token
    data Return Description String Return Description
  • status = PASSWORD_WARN/PASSWORD_EXPIRED, returns password length rules and supported password modification methods verifyTypes: PWD: password, MOBILE: mobile phone, EMAIL: email
  • status = MFA_AUTH, returns secondary authentication methods
  • status = ACCESS_DENIED, returns access denied
  • id_token Short-term valid, interface call credential String This field is a JWT that stores user information and application scope information, requires verification after obtaining, valid for 2 hours by default, supports configuration

    I am ready. Please provide the Markdown content you would like me to translate.