Xác thực

API dùng để lấy access token. Acess token là chuỗi mã hóa chứa thông tin của doanh nghiệp, có thời gian hết hạn là 24 giờ.


Lấy token

Lấy token để truy cập các API khác

POST[URL]/token

Parameters

Header

Acceptapplication/json
Content-Typeapplication/x-www-form-urlencoded

Body

usernameStringTên tài khoản
passwordStringMật khẩu
grant_typeStringMặc định: "password"
json
{
    "username": "",
    "grant_type": "password",
    "password": ""
}

Response

access_tokenStringAccess token truy cập
token_typeStringBearer
expires_inLongThời hạn token tính bằng giây
refresh_tokenStringChuỗi cấp token mới
json
{
    "access_token": "du7wzwDFqB3CzFRCYxK76YNziYEHN6YSWN_xUj1ahUGxxxx",
    "token_type": "bearer",
    "expires_in": 899,
    "refresh_token": "f2bd26e2-5274-4ac3-9db6-0b828027f446"
}

Lấy token mới

Lấy token mới khi token hết hạn

POST[URL]/token

Parameters

Header

Acceptapplication/json
Content-Typeapplication/x-www-form-urlencoded

Body

refresh_tokenStringrefresh_token khi lấy token lần đầu
grant_typeStringMặc định: "refresh_token"
json
{
    "username": "",
    "grant_type": "password",
    "password": ""
}

Response

access_tokenStringAccess token truy cập
token_typeStringBearer
expires_inLongThời hạn token tính bằng giây
refresh_tokenStringChuỗi cấp token mới
json
{
    "access_token": "du7wzwDFqB3CzFRCYxK76YNziYEHN6YSWN_xUj1ahUGxxxx",
    "token_type": "bearer",
    "expires_in": 899,
    "refresh_token": "f2bd26e2-5274-4ac3-9db6-0b828027f446"
}