{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angularfire2/issues/1069","repository_url":"https://api.github.com/repos/angular/angularfire2","labels_url":"https://api.github.com/repos/angular/angularfire2/issues/1069/labels{/name}","comments_url":"https://api.github.com/repos/angular/angularfire2/issues/1069/comments","events_url":"https://api.github.com/repos/angular/angularfire2/issues/1069/events","html_url":"https://github.com/angular/angularfire2/issues/1069","id":242655662,"number":1069,"title":"Bug: afAuth.idToken returns firebase.User instead of idToken","user":{"login":"craigsnyders","id":3810017,"avatar_url":"https://avatars4.githubusercontent.com/u/3810017?v=4","gravatar_id":"","url":"https://api.github.com/users/craigsnyders","html_url":"https://github.com/craigsnyders","followers_url":"https://api.github.com/users/craigsnyders/followers","following_url":"https://api.github.com/users/craigsnyders/following{/other_user}","gists_url":"https://api.github.com/users/craigsnyders/gists{/gist_id}","starred_url":"https://api.github.com/users/craigsnyders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/craigsnyders/subscriptions","organizations_url":"https://api.github.com/users/craigsnyders/orgs","repos_url":"https://api.github.com/users/craigsnyders/repos","events_url":"https://api.github.com/users/craigsnyders/events{/privacy}","received_events_url":"https://api.github.com/users/craigsnyders/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-13T10:27:03Z","updated_at":"2017-07-14T07:12:54Z","closed_at":"2017-07-14T07:12:54Z","body":"### Version info\r\n**Angular:** 4.1.3\r\n**Firebase:** 4.1.3\r\n**AngularFire:** 4.0.0-rc.1\r\n\r\n\r\n`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.\r\n\r\nMy workaround is as follows:\r\n``` typescript\r\n// idToken: Observable<string>;\r\n// note: can't use Observable.fromPromise because firebase.Promise can't be cast to Promise\r\nthis.idToken = this.afAuth.idToken.mergeMap((user) => {\r\n  return Observable.from(user.getIdToken());\r\n});\r\n```\r\n\r\nI am quite happy to submit a PR to alter `.idToken` to be `Observable<string>`. Please let me know of I should go ahead.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/angular/angularfire2/issues/comments/315288811","html_url":"https://github.com/angular/angularfire2/issues/1069#issuecomment-315288811","issue_url":"https://api.github.com/repos/angular/angularfire2/issues/1069","id":315288811,"user":{"login":"jamesdaniels","id":44975,"avatar_url":"https://avatars4.githubusercontent.com/u/44975?v=3","gravatar_id":"","url":"https://api.github.com/users/jamesdaniels","html_url":"https://github.com/jamesdaniels","followers_url":"https://api.github.com/users/jamesdaniels/followers","following_url":"https://api.github.com/users/jamesdaniels/following{/other_user}","gists_url":"https://api.github.com/users/jamesdaniels/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesdaniels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesdaniels/subscriptions","organizations_url":"https://api.github.com/users/jamesdaniels/orgs","repos_url":"https://api.github.com/users/jamesdaniels/repos","events_url":"https://api.github.com/users/jamesdaniels/events{/privacy}","received_events_url":"https://api.github.com/users/jamesdaniels/received_events","type":"User","site_admin":false},"created_at":"2017-07-14T07:12:54Z","updated_at":"2017-07-14T07:12:54Z","body":"Behaving as expected, though the naming is odd, it reflects the JS SDK.\r\n\r\nAs of 4.0 [onAuthStateChanged](https://firebase.google.com/docs/reference/js/firebase.auth.Auth#onAuthStateChanged) is now only triggered on sign-in and out, \r\n[onTokenIdChanged](https://firebase.google.com/docs/reference/js/firebase.auth.Auth#onIdTokenChanged) is the pre-4.0 behavior it's a firebase.User callback which is triggered on all token changes."}}
{"actor":{"display_login":"jamesdaniels"}}