【发布时间】:2020-03-02 09:17:26
【问题描述】:
axios.get('http://localhost:8080/omp/patients', { headers: {authorization: 'Bearer ' + token}})
.then( response => {
this.state = response.data;
}
).catch(ex=> {
alert("You are not registered");
//console.log(e)
});
在网络中,我有字段:“Access-Control-Request-Headers:授权”,但没有字段“授权:令牌”
【问题讨论】:
-
看起来不错,你可以试试
{ headers: { "Authorization": `Bearer ${token}` }} -
别工作! “从源 'localhost:3000' 访问 XMLHttpRequest 在 'localhost:8080/omp/patients' 已被 CORS 策略阻止:对预检请求的响应未通过访问控制检查:它没有 HTTP ok 状态。”
标签: reactjs spring security spring-security axios