小编Ase*_*now的帖子

Firebase登录弹出在Heroku上自动关闭

我们在React中为我们的应用程序使用FireBase登录,并且流程似乎在localhost上正常工作.

但是当我们在Heroku上部署我们的应用程序时,谷歌窗口的登录会出现在屏幕上并几乎立即关闭.

这是我的auth.js

export function loginWithGoogle (email, pw) {
  const provider = googleAuthProvider;
  return firebaseAuth().signInWithPopup(provider)
  .then(saveUser)
  .catch(error => console.log(error));
}
Run Code Online (Sandbox Code Playgroud)

这是login.js

handleGoogleLogin = e => {
    e.preventDefault();
    loginWithGoogle()
      .then(response => {
        // This gives you a Google Access Token. You can use it to access the Google API.
        console.log("After auth...",response);
        //const TOKEN = response.credential.accessToken;
        console.log("result...", response);

        //TODO: Need to call ConsumeSafe API to store the user details
        console.log("invoking getUser");
        getUser(response.data.user.Email).
        then((res) =>{
          this.props.loginHandler(res);
        });

      })
      .catch(error => {
        console.log("Error in …
Run Code Online (Sandbox Code Playgroud)

heroku firebase reactjs firebase-authentication google-developers-console

6
推荐指数
1
解决办法
787
查看次数