Skip to content

Bind User with Mobile or Email

Call this API when using a mobile number or email to bind a platform user. Before calling this API, you need to obtain a temporary token through the WeChat Mini Program Login API.

Request Description

POST https://{your_domain}/api/v2/sdk/social/bind

Request Headers

Parameter NameNameRequiredTypeExample
X-operating-sys-versionCaller client OS versionYesStringwindows10.1.1
X-device-fingerprintCaller client device fingerprintYesString156aysdna213sc50
X-device-ipCaller client IPNoString192.168.1.2
X-agentUser-Agent informationYesStringMozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X)
X-LUsed for international language settingsNoStringzh
X-client-idApplication authorization IDYesStringnTo1eRIub60vPb54WeE6aojPwYwImtl4
X-state-tokenTemporary tokenYesStringeyJhbcOiJ……nEPRiIC4we0
content-typeContent format typeYesStringapplication/json

Request Example

  1. Mobile number + SMS verification code
json
{
    "mobile":"11012345678",
    "verify_code":"232326"
}

Request Parameters

Parameter NameNameRequiredTypeDescription
mobileMobile numberYesStringMobile number that receives the verification code
verify_codeSMS verification codeYesStringReceived verification code
For obtaining the verification code, please refer to Send SMS Verification Code API
type = BIND_MOBILE_SMS
  1. Email + email verification code
json
{
    "email":"zhangsan@qq.com",
    "verify_code":"123456"
}

Request Parameters

Parameter NameNameRequiredTypeDescription
emailEmailYesStringEmail that receives the verification code
verify_codeEmail verification codeYesStringReceived verification code
For obtaining the verification code, please refer to Send Email Verification Code API
type = BIND_EMAIL_EMS

Response Examples

Success Example

HTTP/1.1 200 OK

json
{
    "session_token": "btsiBjx85prcZu6I6Ki057Tmw3nSF2VO",
    "expire": 432000,
    "status": "SUCCESS",
    "id_token": " eyJraWQn0.eyJpc3MiOiJodHR…g1A7jG8O0uw"
}

Error Example

HTTP/1.1 400 Bad Request

json
{
    "error_code": "IDAAS.SDK.COMMON.1007",
    "error_msg": "state_token parameter error"
}

Response Parameters

Parameter NameNameTypeDescription
statusLogin flow status identifierStringSUCCES: Login successful
SOCIAL_BIND: Binding flow
USER_REGISTER: Auto-registration and binding flow
ACCESS_DENIED: Access denied
MFA_AUTH: Secondary authentication
expiresession_token validity periodNumbersession_token validity period
session_tokenUser session_tokenStringUser session_token
id_tokenIdentity token of logged-in user, short-term validStringThis field is in JWT format and contains user identity information. You can refer to Get User Info from id_token to obtain user information. The token validity period defaults to 5 minutes.

BambooCloud IDaaS Open Platform