reactjs - React axios 响应 -> 授权值未出现在标题中
问题描述
这是我的 API 代码。响应标头中没有授权,但如果您查看“网络”窗口中的标头,它存在。如果您能帮助我找出问题所在以及如何解决,我将不胜感激。
const onLogin = async (event) => {
event.preventDefault();
var encrypt = new JSEncrypt();
encrypt.setPublicKey(REACT_APP_ENC_PUB_KEY);
let encryptedPassword = encrypt.encrypt(password);
try {
let res = await axios.post(
`http://xx.xx/api/v1/users/login`,
{
id: email,
password: encryptedPassword,
},
{
headers: {
Accept: 'application/json',
'Content-type': 'Application/json',
withCredentials : true
},
},
)};
catch (err) {
console.log(err);
let errmsg = err.response.data.message;
setErrMsg(errmsg);
}
};
解决方案
推荐阅读
- c# - 无状态声明
- angular - Angular 7 - 有两个不同formGroups的formControls具有相同的formControlName?
- javascript - 使用 MongoDB 和 Nodejs 创建嵌套的子文档/子元素
- xml - 如何使用 PowerShell 从 XML 文件中获取退出代码?
- swift - 如何在 Xcode swift 中以编程方式更改 UIBarButtunItem 功能
- postfix-mta - 如何将 Postfix 配置为仅中继来自特定域的电子邮件?
- python-3.x - 不止一种方法对硒元素进行定位
- istio - 带有 Keycloak 的 Istio OAuth2
- java - Springboot依赖注入在休眠实体中失败
- android - FireBase 卡在 Android 的“运行您的应用程序以验证安装”上