Orish Baidhya :
I want to send a JWT
token to express
server with axios
POST
method.
What I have tried is:
let data = data
let head = {header: { Token: localStorage.getItem("token") }}
axios
.post("http://localhost:3003/api/v/helllo", data, head)
.then((result) => {
console.table(result);
})
.catch((err) => {
console.error(err);
});
falinsky :
Usually, when working with JWT
- Authorization
header is used. Also pay attention that instead of header
- headers
field should be used:
let head = {
headers: {
Authorization: 'Bearer ' + localStorage.getItem("token")
}
};
Beware, that storing tokens in local storage is not secure.
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=410776&siteId=1