我尝试在Web(电子框架)上登录Firebase。当我尝试按以下方式调用方法时,出现错误。在按钮的click事件上调用此代码(不是表单或提交)
const email ="yunus@scp.com"
const password = "deneme"
firebase.auth().signInWithEmailAndPassword(email,password).then(function () {
const database = firebase.database();
database.ref(ref).set(payload).then(function () {
console.log('Synchronization succeeded');
}).catch(function (error) {
console.log('Synchronization failed');
});
})
Ajax响应:
{
a: null
code: "auth/network-request-failed"
message: "A network error (such as timeout, interrupted connection or unreachable host) has occurr
}
在请求标头中,如下所示。原始协议为file://。可能会导致此问题。如果可以的话,如何解决这个问题 请求:
Content-Type: application/json
Origin: file://
Sec-Fetch-Mode: cors
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) SCP/1.29.3 Chrome/76.0.3809.146 Electron/6.1.4 Safari/537.36
X-Client-Version: Node/JsCore/7.18.0/FirebaseCore-web
注意:当尝试对邮递员进行请求时,我也可以成功回复