Authenticated request

In this guide you will see how you can request the API as an authenticated user.

Login as a Reader#

Here is the API route for the authentication /auth/local.

You have to request it in POST.

import axios from 'axios';
const { data } = await'', {
identifier: '***EMAIL***',
password: '***PASSWORD***',

The API response contains the user's JWT in the jwt key.

"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTc2OTM4MTUwLCJleHAiOjE1Nzk1MzAxNTB9.UgsjjXkAZ-anD257BF7y1hbjuY3ogNceKfTAQtzDEsU",
"user": {
"id": 1,
"username": "reader",

You will have to store this JWT;

You should use the JWT in the request to say that you can access to data

import axios from 'axios';
const { data } = await axios.get('', {
headers: {
'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTc2OTM4MTUwLCJleHAiOjE1Nzk1MzAxNTB9.UgsjjXkAZ-anD257BF7y1hbjuY3ogNceKfTAQtzDEsU',