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 |
---|---|---|---|
username | string | Y | Unique username of user |
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 |
country | string | N | country ISO codes alpha-2 as described in the ISO 3166 international standard. https://www.iban.com/country-codes . example: |
| boolean | N | Default is |
| string | Y/N | Front ID image. File ID after uploaded via direct upload URL. Require if |
| string | Y/N | Back ID image. File ID after uploaded via direct upload URL. Require if |
| string | Y/N | Selfie ID image. File ID after uploaded via direct upload URL. Require if |
2. Login with password
Login profile with password
Method: POST
API endpoint
/auth/login
Body
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 |
---|---|---|---|
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 |
---|---|---|---|
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 |
---|---|---|---|
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 |
---|---|---|---|
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 |