Authentication
All web services that require authentication use the JWT mechanism. This document explains how to obtain this token and use it.
Obtaining the Token
Simply call the following web service with your username
and password
.
POST/v1.1/account/jwt/create/
Request Body
{
"username": "username",
"password": "password"
}
Response Body
{
"refresh": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTczMjk3NzExMSwiaWF0IjoxNzMwMzg1MTExLCJqdGkiOiI5N2Y4YTM3MzI2MDA0YWMyYWM5ZTJhZjRkNTJiNmZkMyIsInVzZXJfaWQiOjE1fQ.6otx_uNIGNwL5Ol7LYSJRwkw3zRLslWZlLPhN7PFJp4",
"access": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzMyOTc3MTExLCJpYXQiOjE3MzAzODUxMTEsImp0aSI6ImU4YTI4YTU1NGUwODQ2MzA4MjUzYTAyYmNjNGM0NGVjIiwidXNlcl9pZCI6MTV9.W8brpT9jADlwIt1ZXR2zke4DFu6KQ0pJvMU96B4kHAg",
"pk": 15,
"uuid": "14f8a3fc-287f-4b80-9148-5743c3803214",
"expire_duration": 2592000,
"expires_at": "2024-11-30 18:01:51"
}
Response Codes
Status Code | Description |
---|---|
200 | return access and refresh tokens |
401 | Invalid username or password |
Using the Token
Place the value of the access
field as follows in the request headers:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzMyOTc3MTExLCJpYXQiOjE3MzAzODUxMTEsImp0aSI6ImU4YTI4YTU1NGUwODQ2MzA4MjUzYTAyYmNjNGM0NGVjIiwidXNlcl9pZCI6MTV9.W8brpT9jADlwIt1ZXR2zke4DFu6KQ0pJvMU96B4kHAg
Other Notes
The validity duration of the token is provided in the expire_duration
field, and the expiration time is provided in the expires_at field
in the response. It is understood that after this time, a new token will need to be obtained.