- Courses
- ItemPath API
- Section 1: Authentication
- Logging In
Logging In
In order to receive an access token, you must first login through the /api/users/login endpoint with your username and password passed in the body.
curl --location --request POST 'http://localhost/api/users/login'
--header 'Content-Type: application/json'
--data-raw '{ "username": "username1", "password": "pwdTest"}'
The returned response should be something like:
"username": "{{ your username }}",
"isAdmin": "true",
"accessExpiryDate": "01/01/2022, 12:15:00",
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTYzMTQwNjE4MSwianRpIjoiMmE1NWZlMmMtMjg1Ny00OTJmLTkyMzEtZTlkOTUzZDFhNzZhIiwidHlwZSI6ImFjY2VzcyIsImlkZW50aXR5IjoibWdvcmRvbiIsIm5iZiI6MTYzMTQwNjE4MSwiZXhwIjoxNjMxNDA3MDgxfQ.65uARe8bQuNXHqVk2ykYxe-VeStQChY_Z5mEZ3Sqhec",
"refreshExpiryDate": "02/01/2022, 12:00:00",
"refreshToken": "eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTYzMTQwNjE4MSwianRpIjoiZGNjZTE0NGYtZTI0Ny00NWViLWIwNzQtYzk5YTUzNWI1YjYzIiwidHlwZSI6InJlZnJlc2giLCJpZGVudGl0eSI6Im1nb3Jkb24iLCJuYmYiOjE2MzE0MDYxODEsImV4cCI6MTYzMzk5ODE4MX0.ZKxct86KfVMQ8HDyRVeE6o2_SifF-t2sH5XCO7PV7x4",
"viewId": 1,
"timeZone": null,
"id": 1
Save the returned access token and refresh token. The response also shows when these tokens will expire.