【发布时间】:2016-08-18 22:22:35
【问题描述】:
我有一个使用 Spring Boot 开发的 Java 应用程序,它是后端。 前端是用 ReactJs 开发的应用程序。我使用 REST 服务。 我使用 axios 进行 REST 调用。 我最近在 Spring Boot 中启用了安全性。现在我很难对 axios 调用进行身份验证。
var config = {
auth: {
username: 'bruker',
password: 'passord'
}
};
axios.get('http://localhost:8090/employee/all', config).then(function (response) {
console.log(response)
}.bind(this)).catch(function (response) {
console.log(response)
}.bind(this))
我收到以下错误“预检响应无效(重定向)”
我假设响应被重定向到localhost:8090/login
我还没有找到任何解决方案。我做错了什么?
【问题讨论】:
标签: reactjs spring-security spring-boot axios