Firebase身份验证错误-每当我尝试使用Google登录时

时间:2019-10-20 17:56:15

标签: javascript firebase firebase-authentication

我正在localhost上测试Firebase auth google,但出现以下错误:

  

{代码:“无法进行身份验证/操作”,消息:“身份提供商配置已禁用。”}

     

代码:“不允许进行身份验证/操作”   消息:“身份提供者配置已禁用。”

function googleLogin() {
    const provider = new firebase.auth.GoogleAuthProvider();

    firebase.auth().signInWithPopup(provider).then(function(result) {
        const user = result.user;
        document.write('Hello ${user.displayName}');
        console.log(user)
    })
    .catch(console.log)

}

1 个答案:

答案 0 :(得分:1)

您需要在Firebase控制台中为您的项目启用Google登录提供程序。参见https://firebase.google.com/docs/reference/js/firebase.auth.Error

打开Firebase控制台(https://console.firebase.google.com/project),选择您的项目,单击“身份验证”垂直菜单项,单击“登录方式”标签,然后激活Google登录提供程序