Аутентификация в Страпи
import axios from 'axios';
const { data } = await axios.post('http://localhost:1337/api/auth/local', {
//identifier is email or username
identifier: 'reader@strapi.io',
password: 'strapi',
});
console.log(data);
//data
{
"jwt": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiaWF0IjoxNTc2OTM4MTUwLCJleHAiOjE1Nzk1MzAxNTB9.UgsjjXkAZ-anD257BF7y1hbjuY3ogNceKfTAQtzDEsU",
"user": {
"id": 1,
"username": "reader",
...
}
}
Shirshak kandel