In AngularFire you were able to access the providers (e.g Google) accessToken for the authenticated user.
There does not seem to be a way to access this with AngularFire2?
On initial login say like this:
this.af.auth.subscribe(user=> {
if (user) {
console.log(user.google);
}
});
It will log out the idToken, accessToken, provider, But (on a page refresh) subsequently will log out the standard details (uid, displayName etc....) And the accessToken is not an accessible property?
Is there a way to access the current users accessToken?
getToken
is deprecated now. You should use getIdToken
instead:
this.af.auth.currentUser.getIdToken(true)
.then((token) => localStorage.setItem('tokenId', token));