Hello,
I’ve got a problem. On application (React) I have register and login pages, they were working fine before, but I updated my nodejs and also created new strapi project, made all same settings as my previous one, and now everytime I try using axios.post
to register or login, i get error xhr.js:177 POST http://localhost:1338/auth/local 401 (Unauthorized)
or same error but GET
. To be more precise Here’s error and message:
error: "Unauthorized"
message: "Invalid token."
Why there’s even token mentioned? I’m registering and logging in, I don’t need token.
Here’s my code to login page.
axios
.post('http://localhost:1338/auth/local', {
identifier: this.state.userName,
password: this.state.userPassword
})
.then(response => {
// Handle success.
console.log('Well done!');
login(response.data.jwt);
})
.catch(error => {
// Handle error.
console.log('An error occurred:', error.response);
});
Also, I’m using 1338 port, so that’s not the case. Also with Postman it works fine, I can register and login, everything…