FirebaseExtended / emberfire

The officially supported adapter for using Firebase with Ember
https://firebaseopensource.com/projects/firebaseextended/emberfire/
MIT License
684 stars 263 forks source link

Session.isAuthenticated is not getting updated? #626

Closed sergchernata closed 4 years ago

sergchernata commented 4 years ago

Authentication works, result holds details from auth provider, but this.session.isAuthenticated is false in the console output below. This results in a failed redirect of the user; protected area sends him back to root index.

I can then click to get back into the protected area, so maybe there is simply a delay in the session update. Maybe it doesn't update fast enough and refuses user access.

auth.signInWithPopup(provider)
        .then( result => {
          console.log(result, this.session.isAuthenticated + " - is authenticated")
          this.redirect(result);
        })
        .catch( () => {
          this.set('error', "Something went wrong, please try again.");
        });

Version info

e.g.
DEBUG: -------------------------------
DEBUG: Ember : 3.20.3
DEBUG: Ember Data : 3.20.0
DEBUG: Ember Bootstrap : 4.0.0
DEBUG: Ember Simple Auth : 3.0.0
DEBUG: EmberFire : 3.0.0-rc.6
DEBUG: Firebase : 7.13.2
DEBUG: -------------------------------
mohitsud commented 4 years ago

same issue - would love to know what solution to use.

sergchernata commented 4 years ago

Would be nice to get a response here.

mohitsud commented 4 years ago

I migrated from TORII to Ember-Simple-Auth and that seemed to work for me.

sergchernata commented 4 years ago

I migrated from TORII to Ember-Simple-Auth and that seemed to work for me.

Interesting, I'm already on Simple Auth. Which version of emberfire and simple auth are you using?

sergchernata commented 4 years ago

Were able to make it work via onAuthStateChanged listener instead of signInWithPopup(provider) .then.