I am setting up JWT authentication, everything is working fine but I got stuck at the last piece where I am not sure what I should do.
I have set up my Axios Config as this:
const token = ""
export const axios = Axios.create({
baseURL: "http://localhost:8080",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`
},
});
so here are few problems I have ..
- if I want to log in, I need to have the "Auth" field to be gone, since I am not sending any cookie, if I do so, my backend fires an Exception since the cookie is not complete
- How should I go about the Axios config, should I fill the "token" variable OR should I work here with the cookie in the local storage?
- Is it a good practice to have multiple configs and use them simultaneously depending on the situation?
hope anyone can help me out! :)