问题描述
我从我的反应前端发送这个到我的节点后端
const data = await axios.post('http://localhost:5000/api/login',{email,password},{
headers:{
'Authorization':'somesecretkey'
}
});
我试图接受这样的标题
const { headers } = req;
console.log(headers);
但我得到了这个
{
host: 'localhost:5000',connection: 'keep-alive','content-length': '54','sec-ch-ua': '" Not;A Brand";v="99","Microsoft Edge";v="91","Chromium";v="91"',accept: 'application/json,text/plain,*/*','sec-ch-ua-mobile': '?0','user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML,like Gecko) Chrome/91.0.4472.114 Safari/537.36 Edg/91.0.864.59','content-type': 'application/json;charset=UTF-8',origin: 'http://localhost:3000','sec-fetch-site': 'same-site','sec-fetch-mode': 'cors','sec-fetch-dest': 'empty',referer: 'http://localhost:3000/','accept-encoding': 'gzip,deflate,br','accept-language': 'en-US,en;q=0.9'
}
那是我在后端没有得到任何授权标头。
我做错了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)