5

I have used google sign in popup method in vuejs. In live google sign in pop up window flashes and never signed in. But everything works fine in local.

Here is firebase google sign in & sign up method code:

 const database = firebase.initializeApp(config);

 const firestore = database.firestore();

 var provider = new firebase.auth.GoogleAuthProvider();

 database.signIn = async (email, password) => {

   try {
   await firebase.auth().signInWithPopup(provider).then((result) => {
  // This gives you a Google Access Token. You can use it to access Google API.
  var token = result.credential.accessToken;
  // The signed-in user info.
  var user = result.user;

  console.log("user",user.displayName);
  console.log('result google',result.user);
  // ...
  store.commit("setCurrentUser", result.user);

   }).catch(function(error) {
        // Handle Errors here.
        var errorCode = error.code;
        var errorMessage = error.message;
        // The email of the user's account used.
        var email = error.email;
        // The firebase.auth.AuthCredential type that was used.
        var credential = error.credential;
        // ...
      });

      return true;
     } catch (error) {
      return error;
    }
  }

Tried by changing chrome pop up, cookies setting nothing works. Any help much appreciated please...

2

2 Answers 2

3

If it's working locally, you should make sure your hosting domain is registered with Google OAuth.

In Firebase console:

Develop -> Authentication -> Sign-in method -> Authorized domains

And add your domain to the list. It may take some time to verify.

If that doesn't work, try logging error.message for more information.

Sign up to request clarification or add additional context in comments.

Comments

1

After updating firebase it works fine. npm i firebase@latest..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.