Auth

Login user and return user's token

/api/v1/users/token/

Body

param type optional
username string False
password string False

Example curl request

curl -X POST \
  http://localhost:8000/api/v1/users/token \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{"username": "admin", "password": "admin"}'

Example response

{
    "token": "8ff04973157b2a5831329fbb1befd37f93e4de4f"
}

Get user info

/api/v1/users/

Example curl request

curl -X GET \
  http://localhost:8000/api/v1/users \
  -H 'Authorization: token {{token}}' \
  -H 'Cache-Control: no-cache' \

Example response

{
    "username": "root",
    "email": "[email protected]",
    "is_superuser": true
}