[Firebase] firebase.auth().signInWithPopup

https://firebase.google.com/docs/auth/web/facebook-login

Please tell me how do I want to change the above code for it.

Your OP confuses me. You mention popup, but your code uses redirect. So I guessed that the code you were using was different from the code you posted. This often happens – people say their code isn’t working, and then they don’t post the part of their code that doesn’t work.

You can almost copypaste the code in the link I provided.

Beyond that, I’m not sure what you’re asking.

1 Like

Is it possible to use for ionic v3?

Yes, I have it working in an Ionic 3 project.

Here the code that I used for Signup with Google button,

loginGoogle() {
    let provider = new firebase.auth.GoogleAuthProvider();
    provider.addScope('https://www.googleapis.com/auth/contacts.readonly');
    firebase.auth().signInWithRedirect(provider);
    firebase.auth().getRedirectResult().then(function (authData) {
      this.navCtrl.push(TabsPage);
    }).catch(function (error) {
      console.log(error);
    });
  }

In mobile device nothing happens after click that button.

Why are you doing it differently from the documentation I linked you to?

Nothing happens when click the button, in browser it redirect to a blank white screen, in mobile nothing happens,

loginGoogle() {
    var provider = new firebase.auth.GoogleAuthProvider();
    provider.addScope('https://www.googleapis.com/auth/contacts.readonly');
    firebase.auth().signInWithRedirect(provider);
    firebase.auth().getRedirectResult().then(function (result) {
      if (result.credential) {
        // This gives you a Google Access Token. You can use it to access the Google API.
        var token = result.credential.accessToken;
        // ...
      }
      // The signed-in user info.
      var user = result.user;
    }).catch(function (error) {
      
    });
  }

Now it perfectly redirect to the google account selector, but when select it give me a white screen with this sentence,
mobile app identifier is not registered for the current project

1 Like

1 Like

You need to set up your app within the firbase console. This is the full tutorial on how to do that.

Have you found a solution? I am still trying to get that code to work for android mobile browser

We understand this is the case for projects built for Android and iOS but what about mobile browser?

It seems to me that cordova should not be a factor if someone is accessing an ionic project on a website.

But I could be wrong… I frequently am.

If someone is accessing the website through a browser on their phone all the afore mentioned issues arise. But accessing the site on a desktop presents no issue when using signinWithPopup().

You’ll need to post your error and possibly your code if you want help with that. Maybe the new Firebase changed something.

Sure but should I make it a new discussion topic? I’m thinking it would be best for those looking explicitly to implement this for mobile browser.

I agree. I thought about suggesting that but decided it might be rude. Should have just done it!

For mobile browser

Not at all. I made a new topic.