Answer the question
In order to leave comments, you need to log in
Why does a 403 error occur during authorization?
client: https://codesandbox.io/s/wqjrv7746k
server: https://repl.it/@be1dev/MeagerBlindTrace-1
Expected behaviour. By clicking on register, we get a token, save it in localStorage (it works), immediately the second request to read data from a closed route on the server, present the token (403).
Through Postman it works without errors.
Answer the question
In order to leave comments, you need to log in
try it like this
axios({
method: 'post',
url: `${ROOT_URL}/posts`,
data: {
},
headers: { authorization: localStorage.getItem("token") }
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question