【问题标题】:google authentication pop up not working using firebase in react app谷歌身份验证弹出无法在 React 应用程序中使用 Firebase
【发布时间】:2021-01-09 17:48:16
【问题描述】:

在做一个项目时...我用谷歌帐户进行了身份验证。 但它不起作用

我使用 firebase 进行身份验证,当我点击按钮时……什么都没有显示……

firebase 代码如下

firebase.initializeApp(config);
 export const auth= firebase.auth();
 export const firestore=firebase.firestore();
 
 const provider=new firebase.auth.GoogleAuthProvider();
 provider.setCustomParameters({prompt:'select_account'});
 export const signInWithGoogle=()=>auth.signInWithPopup(provider);

 export default firebase;

调用代码是

<CustomButton type='submit'> SIGN IN</CustomButton>
<CustomButton onClick={signInWithGoogle}> SIGN IN WITH GOOGLE</CustomButton>

但两个按钮的行为相同..它显示所需的电子邮件...当我单击使用 google 登录时没有弹出窗口显示

自定义按钮是一个反应组件

请帮忙

【问题讨论】:

    标签: javascript reactjs firebase-authentication google-signin


    【解决方案1】:

    我遇到了类似的问题:弹出窗口出现了,但没有加载。我通过将onSubmit:{this.handleSubmit} 属性添加到标记&lt;form&gt; 来修复它

    handleSubmit = event => {
            event.preventDefault();
            this.setState({ email: ' ', password: ' ' });
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-01-01
      • 1970-01-01
      • 2013-02-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-14
      • 1970-01-01
      相关资源
      最近更新 更多