-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AngularFireAuth idToken emits a string instead of User #1464
Comments
See #1069 |
Can you help me understand your use case? Happy to reevaluate the change or put something else in there. |
Hi James, thanks for getting back to me. My use case is this: this.af.auth.createUserWithEmailAndPassword(email, password)
.then((afUser: firebase.User) => {
return afUser.updateProfile({
displayName: [firstName, lastName].join(' ').trim(),
}).then(() => afUser.sendEmailVerification());
})
.then(() => this.af.auth.signInWithEmailAndPassword(email, password))
.catch((err) => {
this.handleFirebaseError(err);
}); Under pre-4.0.0 angularFire2, the After the update, I had hoped to just change It seems odd to me that the |
Have to agree with @markstuart that it should return the User instead a string, since I want to store the User information in cookie. |
@jamesdaniels It seems to me that one of the aims of the AngularFire2 4.0 upgrade was to simplify the authentication api, and in doing so bring it more in line with the Firebase library. To me, the meaning of Firebase provide it as a backward compatible way of detecting changes in the auth state (including refresh events), and it was originally your intention to do the same. Given that the AngularFire2 auth api is not extensively documented, and Firebase's api docs are rather more extensive (completely understandable of course, on both counts) it makes sense for the auth methods to follow the Firebase ones so that there aren't too many surprises like this one. |
FYI We're planning on adding |
Thanks for the heads up @jamesdaniels, looking forward to replacing my hack of your original implementation of |
Addressing in #1642 |
Just cut rc.9, which includes the change |
Quick question @jamesdaniels : do I still have to set & watch a meta-data in db and then trigger Update Update 2 |
Yes I am kind of confused to see that |
Hi there, thanks for a great library, I've been using it on a large-ish project for a year or so.
I recently upgraded Angular/AngularFire/Firebase in the project and struck an issue with the account creation flow that took me a little while to fathom. It all came down to the change of behaviour of
authState
in 4.0.0-rc0, due to the underlying change in Firebase'sonAuthStateChanged
. After finding your changelog entry stating "The added AngularFireAuth.idToken: Observable<firebase.User> behaves as authState used to." I tried using it, but found the signature did not match what I was expecting.Also, I read your v4 upgrade guide but didn't see any mention of the backward compatible
idToken
observable.I have downgraded to AngularFire 5.0.0-rc.0 as a temporary workaround, to get latest version before
idToken
was altered.Version info
Angular: 5.2.2
Firebase: 4.9.1
AngularFire: 5.0.0-rc.6
Other (e.g. Ionic/Cordova, Node, browser, operating system):
Expected behavior
idToken
would be a drop-in replacement for users upgrading from pre-4.0.0 angularfire2'sauthState
, as described in the changelogThis makes sense as it follows the interface of the firebase library's
onIdTokenChanged
which returns a nullable firebase.UserActual behavior
idToken
emits the result of theuser.getIdToken
promise to subscribers. This behaviour appears to have changed in this commit: 8ab3803The text was updated successfully, but these errors were encountered: