Reputation: 21
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:
I use the cordova plugin for authorization via google to get idToken.
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?
Upvotes: 0
Views: 87
Reputation: 1
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 })
Upvotes: 0