Google sign in with firebase3 Ionic platform

As many of you might know, firebase3 currently does not support loginwithredirect and loginwithpopup in Ionic platform. So I am doing it manually by following the instruction on firebase under “Advanced: Handle the sign-in flow manually” and have tried many different methods. I hope this forum can be a discussion place for people using Ionic with Firebase since Firebase3 is not currently support Ionic in many places. I am actually facing several challenges and it would be great if someone can answer these questions.

  1. Just following the guideline on google and firebase, the actual sign in button never shows up, so I changed my method by following this guide. It would be great if anyone knows why the original method doesn’t work.

  2. After finally getting the button, I was able to get the Ionic web page to sign in, but when I deploy to my android, it shows an error that says

Error: invalid_request
invalid parameter alue for redirect_url: invalid storagerelay URL: storagerelay://file/?id=auth947648.

I wonder if this has to do with Ionic on mobile?

  1. Another google login method I tried was using cordovaoauth to get the id token and then sign in with firebase. Just as I thought I got it to work, it appears that I am always logged in as the same user even if I signed out with firebase. I followed the signinwithcredential instruction on firebase to set everything up. Here is my code.

 this.loginWithGoogle = function loginWithGoogle() {
 $"googleclientid", ["email"]).then(function(result) {
 console.log("Response Object -> " + JSON.stringify(result));

  var unsubscribe = firebase.auth().onAuthStateChanged(function(firebaseUser) {
// Check if we are already signed-in Firebase with the correct user.
  // Build Firebase credential with the Google ID token.
  var credential = firebase.auth.GoogleAuthProvider.credential(
  console.log("this is the cedential" +credential);
  // Sign in with credential from the Google user.
  firebase.auth().signInWithCredential(credential).catch(function(error) {
    // Handle Errors here.
    var errorCode = error.code;
    var errorMessage = error.message;
    // The email of the user's account used.

    var email =;
    // The firebase.auth.AuthCredential type that was used.
    var credential = error.credential;
    // ...


1 Like