Help Center/ OneAccess/ API Reference/ OneAccess APIs/ User APIs/ Registration/ Registering a User with a Mobile Number and SMS Verification Code
Updated on 2024-12-30 GMT+08:00

Registering a User with a Mobile Number and SMS Verification Code

Function

This API is used to register a user by using a mobile number and an SMS verification code.

URI

POST /api/v2/sdk/register/mobile-verify-code

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Set this field to "application/json;charset=utf8".

X-operating-sys-version

Yes

String

Caller OS version, for example, Android 10.

X-device-fingerprint

Yes

String

Caller device fingerprint, for example, 156aysdna213sc50.

X-device-ip

No

String

Caller IP address, for example, 10.10.10.1

X-agent

Yes

String

User agent information, for example, Mozilla/5.0 (Linux; Android 10; Redmi K30 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.99 Mobile Safari/537.36

X-L

No

String

Language type, for example, en.

X-client-id

Yes

String

Application ID, which is a ClientId allocated to an application after registration.

X-tenant-id

No

String

Tenant ID. This parameter is mandatory when calling an ISV application. Replace "{domain_name}" with the ISV common domain name "{common_domain}". In the request header, specify tenant_id of the corresponding tenant and replace X-client-id with client_id of the ISV application template.

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

user_name

No

String

Username.

name

No

String

Name.

mobile

Yes

String

Mobile number.

verify_code

Yes

String

SMS verification code.

email

No

String

Email address.

pwd

No

String

Password.

head_img

No

String

Profile picture. Enter the URL.

attr_gender

No

String

Gender.

attr_birthday

No

String

Date of birth. Format: yyyy-MM-dd.

attr_nick_name

No

String

Alias.

first_name

No

String

Name.

middle_name

No

String

Middle name.

last_name

No

String

Last name.

extension

No

Object

Custom extended attribute.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

status

String

Return result.

expire

Integer

session_token validity period. Unit: second. Within the validity period, ticket can be obtained using session_token.

session_token

String

User session_token, which can be used to call the SSO API to obtain sso_ticket. User information can be obtained using sso_ticket.

id_token

String

It is essentially a JWT token that contains user identity information. The token is valid for 2 hours by default and its validity period can be configured.

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error details.

Example Requests

Register a user using a mobile number and SMS verification code. Username is John, name is Johnson, mobile number is 12345678901, SMS verification code is 1234, email address is 12345678901@example.com, and password is Q******3. Age value of the custom extended field is 18.

POST https://{domain_name}/api/v2/sdk/register/mobile-verify-code

X-operating-sys-version: Android 10
X-device-fingerprint: 156aysdna213sac
X-device-ip: 10.10.10.1
X-agent: Mozilla/5.0 (Linux; Android 10; Redmi K30 Build/QKQ1.190825.002; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/80.0.3987.99 Mobile Safari/537.36
X-L: zh
X-client-id: DRrYIqauawN0I8myTMoDTPys6ezGZxnm
X-tenant-id: 08f770f51f80d2f40f38c00cb199fd21

{
  "user_name": "John",
  "name": "Johnson",
  "mobile": "12345678901",
  "verify_code": "1234",
  "email": "12345678901@example.com",
  "pwd": "Q******3",
  "head_img": "
  https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTIQ8QOTSn3y4cYHLlMC3sv6RCBmeMkxtOog47Zr3v2Afbqc2bmP0WibUIUskX39eJlJ",
  "attr_gender": "male",
  "attr_birthday": "Feb 17, 2022",
  "attr_nick_name": "Johnson",
  "first_name": "Johnson",
  "middle_name": "Johnson",
  "last_name": "Johnson",
  "extension": {
    "age": "18"
  }
}

Example Responses

Status code: 200

Request successful.

{
  "status" : "SUCCESS",
  "expire" : 43200,
  "session_token" : "LGT******sqa"
}

Status Codes

Status Code

Description

200

Request successful.

400

Invalid parameter.

Error Codes

See Error Codes.