我尝试使用 Firebase (Google) 身份验证,但收到此错误:
此应用程序运行的环境不支持此操作。 “location.protocol”必须是 http、https 或 chrome-extension,并且必须启用 Web 存储。
我的代码是:
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
如果您在本地运行项目,则可以通过启动本地服务器来解决此问题,而不是直接在浏览器中打开文件。我就是这样修好的。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)