Auth Service

I. Architecture design

II. Public API

1. Register with password

Register profile with password

  • Method: POST

  • API endpoint /auth/register

  • Body

Field name

Data type

Mandatory

Description

Field name

Data type

Mandatory

Description

username

string

Y

Unique username of user

email

string

Y

Unique email of user

password

string

Y

User password. Min length is 6 and max length is 64

firstName

string

N

First name

lastName

string

N

Last name

name

string

N

Display name in the system

phone

string

N

Phone number

gender

string

N

Accept male, female or unknown

country

string

N

country ISO codes alpha-2 as described in the ISO 3166 international standard. https://www.iban.com/country-codes .

example: US, CA

isModel

boolean

N

Default is false

frontIDFileId

string

Y/N

Front ID image. File ID after uploaded via direct upload URL.

Require if isModel is true

backIDFileId

string

Y/N

Back ID image. File ID after uploaded via direct upload URL.

Require if isModel is true

selfieWithIDFileId

string

Y/N

Selfie ID image. File ID after uploaded via direct upload URL.

Require if isModel is true

2. Login with password

Login profile with password

  • Method: POST

  • API endpoint /auth/login

  • Body

Field name

Data type

Mandatory

Description

Field name

Data type

Mandatory

Description

username

string

Y

Unique username of user

password

string

Y

User password. Min length is 6 and max length is 64

3. Forgot password

Forgot password with email

  • Method: POST

  • API endpoint /auth/forgot

  • Body

Field name

Data type

Mandatory

Description

Field name

Data type

Mandatory

Description

email

email

Y

Unique email of user

4. Change password (forgot)

Change your password after an email is sent

  • Method: POST

  • API endpoint /auth/change-password

  • Body

Field name

Data type

Mandatory

Description

Field name

Data type

Mandatory

Description

token

string

Y

JWT token from email

password

string

Y

User password want change. Min length is 6 and max length is 64

5. Change own password

Change your password after an email is sent

  • Method: POST

  • API endpoint /auth/me/change-password

  • Body

Field name

Data type

Mandatory

Description

Field name

Data type

Mandatory

Description

oldPassword

string

Y

current password

password

string

Y

User password want change. Min length is 6 and max length is 64

6. Admin change profile password

Change your password after an email is sent

  • Method: POST

  • API endpoint /auth/admin/change-password

  • Body

Field name

Data type

Mandatory

Description

Field name

Data type

Mandatory

Description

profileId

string

Y

id of profile need change password

password

string

Y

User password want change. Min length is 6 and max length is 64

5. Verify Email