const sendRequest = async () => { try { const response = await axios.post("http://localhost:8080/auth/login", { username: username, password: password, }); console.log(response.data); const authorizationHeader = response.headers["Authorization"]; if (authorizationHeader) { localStorage.setItem("token", authorizationHeader); console.log("Token stored in localStorage."); } else { console.log("No Authorization header received."); } } catch (error) { console.log("Error:", error); } }; this is my function above but even though I see the header I want to get "Authorization" on both network on chrome browser and postman I'm not able to get it. What am I doing wrong?
x-auth-token. You'll still need the appropriateaccess-control-expose-headersthough (see the duplicate link). Even better would be to send it in a cookie