gpt4 book ai didi

javascript - 如何修复 "This operation is not supported in the environment this application is running on. "location.protocol"..."错误?

转载 作者:行者123 更新时间:2023-12-04 17:33:48 24 4
gpt4 key购买 nike

我尝试使用 Firebase (Google) 身份验证,但出现此错误:

This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.



我的代码是:
var provider = new firebase.auth.GoogleAuthProvider();  

function Singin(){
firebase.auth().signInWithPopup(provider).then(function(result) {
var user = result.user;
console.log(user);
}).catch(function(error) {
console.log(error);
console.log(error.message)
});
}

完整的错误是:
zi {code: "auth/operation-not-supported-in-this-environment", message: "This operation is not supported in the environment…chrome-extension and web storage must be enabled."}
code: "auth/operation-not-supported-in-this-environment"
message: "This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled."
__proto__: Error

最佳答案

不能用 NodeJS 运行客户端 JS,其中 location.protocol可能是 typeof "undefined" .您为环境使用了错误的客户端库;试试 the other one . JavaScript 和 JavaScript 不一定是同一个东西......

关于javascript - 如何修复 "This operation is not supported in the environment this application is running on. "location.protocol"..."错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57506930/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com