0

As I understood, emberfire auth works via torii and includes the own torii-provider (torii-providers/firebase.js).

When I try to sign in, it runs signInWithPopup method from the firebase provider. It does not work when the application is running on a mobile device via cordova (location.protocol is equal to "file:").

I've found a workaround:

  1. I use the cordova plugin for authorization via google to get idToken.

  2. I've overridden the provider to use signInWithCredential:

    export default ToriiFirebaseProvider.extend({
      open(idToken) {
        const firebaseApp = get(this, 'firebaseApp');
        const credentials = get(firebaseApp, 'firebase_.auth.GoogleAuthProvider.credential')(idToken);
        return firebaseApp.auth().signInWithCredential(credentials);
      }
    });
    

It works now, but I'm not sure that it's the right solution?

henrycarteruk
  • 12,708
  • 2
  • 36
  • 40

1 Answers1

0

So, you want a redirect instead of a pop-up? If that's what you want, just set the redirect option:

this.get('session').open('firebase', { provider:'google', redirect: true })
Michel
  • 1