Social Account Login Bind Mobile or Email API
Used for social account binding mobile phone or email operations. On success, the user's session_token is returned; on failure, failure information is returned.
Request Description
Request Headers
| Parameter Name | 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) AppleWebKit/605.1.15(KHTML, like Gecko) Mobile/15E148/HuaWei-AnyOffice/2.6.1802.0010/com.huawei.cloudlink.workplace |
| X-L | Used for internationalization language setting | No | String | zh |
| X-client-id | Application authorization ID | Yes | String | nTo1eRIub60vPb54WeE6aojPwYwImtl4 |
| X-state-token | Temporary token | Yes | String | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZW1... |
Request Example
- Use mobile phone + SMS verification code
json
{
"mobile":"15201657321",
"verify_code":"123456"
}Request Parameters
| Parameter Name | Name | Required | Type | Description |
|---|---|---|---|---|
| mobile | Mobile phone number | Yes | String | Mobile phone number receiving the verification code |
| verify_code | Verification code | Yes | String | Received verification code For obtaining the verification code, please refer to Send SMS Verification Code API type=BIND_MOBILE_SMS |
- Use email + email verification code
json
{
"email":"zhangsan@qq.com",
"verify_code":"123456"
}Request Parameters
| Parameter Name | Name | Required | Type | Description |
|---|---|---|---|---|
| Yes | String | Email address receiving the verification code | ||
| verify_code | Verification code | Yes | String | Received verification code For obtaining the verification code, please refer to Send Email Verification Code API type=BIND_EMAIL_EMS |
Response Example
Success Example
HTTP/1.1 200 OK
json
{
"session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
"expire": 604800,
"status": "SUCCESS",
"id_token": "eyJraWQiOiJrMSIsImFsZyI6IlJTMjU2In0.eyJpc3MiOiJJc3N1ZXIiLCJhdWQiOiJBdWRpZW5jZSIsImV4cCI6MTY1MzQ4NDQxMiwianRpIjoieUxSVGZXY1VkYk9PeUFpbHdZU0ZqZyIsImlhdCI6MTY1MzQ2NjQxMiwibmJmIjoxNjUzNDY2MjkyLCJzdWIiOiJzdWJqZWN0IiwiYXBpIjoie1wibmFtZVwiOlwiXCIsXCJtb2JpbGVcIjpcIis4Ni0xNTkwNzEzMjg1MlwiLFwiaWRcIjpcIjIwMjIwNDI1MTQwMTM4NTE5LUJGMUItNTI4QjA1NTFCXCIsXCJ1c2VyTmFtZVwiOlwibG91eGlcIixcImVtYWlsXCI6XCIxMUBxcS5jb21cIn0ifQ.al79knH1fKa4aT4AFr_FMjqBKu2pV_g-lKzzgHzmor5X-dHwSBUtjH38KOzjIqHvkcRMjXQuBnWmjRI7-0Djn2LuWVueaf3wRXLscCWiSDC7chjUyTRXMatYINxdvW-oSWFYGFqqbdsavLqOnvehd7ahEaTuiL9yZolvslZIkIxjxBJJu7A9Ln2sk3wf9pxXU83jIJ8ubPQBoVS-ilerTTJOKDZ9XsL2ftJsaqdTJK_mYbvKaVpLIVyHHJ2NcF6f-Al4N4kc8cgxtSgSKFDcR7Bz7dYlOcfUXCPAzJ3NZInm8UaksiWU02tvlvTRvRdoxZNnvD5vamZ5hjFc-cW5jA"
}Error Example
HTTP/1.1 400 Bad Request
json
{
"error_code": "IDAAS.SDK.COMMON.1001",
"error_msg": "Parameter X-client-id cannot be left blank."
}Response Parameters
| Parameter Name | Name | Type | Description |
|---|---|---|---|
| status | Return result | String | Possible values are as follows SUCCESS login successful ACCESS_DENIED access denied |
| expire | session_token validity period | Number | session_token validity period; within the validity period, session_token can be used to obtain ticket |
| session_token | User session_token | String | User session_token; this token can be used to call IDaaS APIs to obtain sso_ticket, and sso_ticket can be exchanged for user information |
| id_token | Short-term valid interface call credential | String | This field is a JWT that stores user information and application scope information; it needs to be verified and obtained after signature verification. The default validity period is 2 hours and is configurable. |
Error Codes
| Status Code | Error Code | Chinese Error Message | English Error Message | Resolution |
|---|---|---|---|---|
| 400 | IDAAS.SDK.PARAM.0001 | 设备信息不完整 | Device information is incomplete | Please check whether the input device information is complete |
| 400 | IDAAS.SDK.PARAM.0002 | clientId不能为空 | clientId cannot be empty | Please check whether the input clientId is empty |
| 400 | IDAAS.SDK.PARAM.0003 | 应用未注册,请先注册应用 | The app is not registered, please register the app first | Please check whether the input clientId is correct |
| 400 | IDAAS.SDK.PARAM.0015 | IdToken不能为空 | IdToken cannot be empty | Please check whether the input IdToken is empty |
| 400 | IDAAS.SDK.PARAM.0016 | IdToken无效或已过期 | IdToken is invalid or expired | Please re-acquire the IdToken and try again |
| 400 | IDAAS.SDK.PARAM.0017 | 社交ID不能为空 | Social ID cannot be empty | Please check whether the input social ID is empty |