【发布时间】:2020-11-19 04:43:48
【问题描述】:
我在 axios 的 post 方法上收到错误代码:
错误:
Access to XMLHttpRequest at 'https://identitytoolkit.googleapis.com/v1/signupNewUser?key=AIzaSyAHO' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
代码:
const authData = {
email: email,
password: password,
returnSecureToken:true
}
axios.post('https://identitytoolkit.googleapis.com/v1/signupNewUser?key=AIzaSyAHOBs', authData)
.then( response => {
console.log(response);
dispatch(authSuccess(response.data));
})
.catch(err => {
console.log(err);
dispatch(authFail(err));
});
【问题讨论】:
标签: reactjs firebase react-redux axios