Skip to content

Conversation

@jamesdaniels
Copy link
Member

Checklist

Description

  • Updating the Firebase dependency
  • Removing some unused vars in the auth spec
  • Adding as observable for onIdTokenChanged, as onAuthTokenChanged is only triggered on sign-in/out

See the Firebase JS SDK changelog for more information.

Code sample

Triggered on sign-in, sign-out, and token change:
afAuth.idToken.subscribe(user => console.log(user));

Triggered on sign-in/out only:
afAuth.authState.subscribe(user => console.log(user));

@jamesdaniels jamesdaniels changed the title Firebase 4.0 (breaking change alert) Update to Firebase JS SDK 4.0 (breaking changes) May 23, 2017
user: Observable<firebase.User>;
constructor(afAuth: AngularFireAuth) {
this.user = afAuth.authState;
this.user = afAuth.authState; // only triggered on sign-in/out (for old behavior use .idToken)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need more here to explain how to use both? It seems like most users will just go with .idToken since it behaves like authState did. We should also update the main Authentication doc, but I guess we could do that after this PR is merged.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we'll definitely address this in the auth section of the docs.

@davideast davideast changed the title Update to Firebase JS SDK 4.0 (breaking changes) chore(sdk): Update to Firebase JS SDK 4.0 (breaking changes) May 24, 2017
@davideast davideast merged commit 9642f58 into angular:master May 24, 2017
@jamesdaniels jamesdaniels deleted the update_firebase_dep branch May 24, 2017 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants