【发布时间】:2019-09-23 23:06:06
【问题描述】:
有人可以为我在尝试使用 google oath 的 firebase Web 应用程序中遇到的问题推荐解决方案。
这里是sn-p的代码:
//login with google
const googleButton = document.querySelector('#googleLogin');
googleButton.addEventListener('click', (e)=>{
e.preventDefault();
M.Modal.getInstance(modal).close();
loginForm.reset();
const provider = new firebase.auth.GoogleAuthProvider();
auth.signInWithPopup(provider).then(function(result){
console.log(result);
console.log("Successful Google Sign in");
}).catch(function(error){
console.log(error);
console.log("Login failed");
这是我从浏览器获得的响应负载:
{
"error": {
"code": 400,
"message": "OPERATION_NOT_ALLOWED : The identity provider configuration is disabled.",
"errors": [
{
"message": "OPERATION_NOT_ALLOWED : The identity provider configuration is disabled.",
"domain": "global",
"reason": "invalid"
}
]
}
}
我得到的不是控制台日志中的Successful Google Sign in,而是:
自动为“http://127.0.0.1:5500”上的跟踪器“https://nompu-website.firebaseapp.com”授予存储访问权限。
我已启用 Google 作为登录选项之一。
【问题讨论】:
-
您确定从 Firebase 控制台启用了登录方法吗?
标签: javascript firebase google-api