Skip to content

Bug: afAuth.idToken returns firebase.User instead of idToken #1069

Closed
@craiggoldstone

Description

@craiggoldstone

Version info

Angular: 4.1.3
Firebase: 4.1.3
AngularFire: 4.0.0-rc.1

afAuth.idToken and afAuth.authState seem to be duplicates of each other, both having the type Observable<firebase.User> and identical implementations. I understand this may be fallout from v4.0.0 but I can't see any reason why .idToken shouldn't return the actual token.

My workaround is as follows:

// idToken: Observable<string>;
// note: can't use Observable.fromPromise because firebase.Promise can't be cast to Promise
this.idToken = this.afAuth.idToken.mergeMap((user) => {
  return Observable.from(user.getIdToken());
});

I am quite happy to submit a PR to alter .idToken to be Observable<string>. Please let me know of I should go ahead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions