signInWithRedirect does not display when using ionic emulate


#1

Hi!

I’ve upgraded my ionic 1 app to firebase v3. Since then my signInWIthPopup for Facebook Login has stopped working.

These are the steps I have taken so far and it’s mostly working, except on the emualtor / testlfight!

  1. switched to signInWithRedirect and then getRedirectResult
  2. found that signInWithRedirect displayed a white screen, partial fix by using cordova whitelist plugin and putting into the config.xml (will specify the urls later)
  3. ionic serve --livereload, ionic emulate --livereload both will now display the user login window properly

Outstanding Issue: ionic emulate does not open the signInWithRedirect window at all

I’m not sure why!


#2

that currently is not supported in the newest version of firebase, you will need to manage getting the auth token yourself.

See example project here: https://github.com/aaronksaunders/AngularFire2-Ionic2-Facebook

      Facebook.login(['email'])
        .then((_response) => {
          console.log(_response)

          /// THIS IS THE MAGIC ....
          // - See Documentation
          // https://firebase.google.com/docs/reference/js/firebase.auth.FacebookAuthProvider#credential
          //
          let creds = firebase.auth.FacebookAuthProvider.credential(_response.authResponse.accessToken)
          /////////////////////////

          let providerConfig = {
            provider: AuthProviders.Facebook,
            method: AuthMethods.OAuthToken,
            remember: 'default',
            scope: ['email'],
          };
          this.af.auth.login(creds, providerConfig)
            .then((success) => {
              console.log("Firebase success: " + JSON.stringify(success));
              alert(JSON.stringify(success))
            })
            .catch((error) => {
              console.log("Firebase failure: " + JSON.stringify(error));
              alert(JSON.stringify(error))
            });

        })
        .catch((_error) => { console.log(_error) })
    });