【发布时间】:2018-06-17 01:05:02
【问题描述】:
我正在使用 ReactJS 和 Axios 构建一个登录页面。我的团队已经启动了一个可以响应 Postman 请求的本地服务器。
由于某些原因,它在我的登录页面上不起作用。这是我的代码:
const request = axios.request({
url: `http://codelab:20080/uaa/oauth/token?grant_type=password&username=thien&password=123456`,
method: 'POST',
headers: {
'Authorization': "Basic YnJvd3Nlcjo=",
}
}).then(response => {
console.log(response);
}).catch(error => {
console.log(error);
});
还有错误:
我不确定导致我的代码失败的那些请求之间有什么不同。我还安装了“Allow-Control-Allow-Origin”扩展,但没有用。
【问题讨论】:
标签: javascript react-redux axios http-status-code-401