Login
Updated date: 30/04/2023
Updated by: VNPT eContract's team
Purpose
Obtain the token code information to access APIs that require authentication.
- Request URL:
api/auth/password-login
- HTTP method:
POST
- HTTP content-type:
application/json
- Parameter:
Key | Type | Description |
---|---|---|
username | string | [Required] Username of user |
password | string | [Required] Password of user |
companyId | int | [Required] Id of company |
Caution
If the company ID is not available for login, call this function and omit the companyId parameter to retrieve the access token. Then, call the get company list function and finally call this function again with the companyId parameter of the company that needs to log in and perform the operation.
Sample request
{
"username": "username.demo@email.com",
"password": "123456&abcdef",
"companyId": 668
}
Sample response body
{
"data": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9……",
"success": true,
"code": 0,
"messages": [
"Authenticate and choose company success"
]
}
Return code
Code | Description |
---|---|
200 (OK) | Success |
401 (Unauthorized) | Token is wrong or expired |
502 (Bad Gateway) | Timeout |