Angular:
2.0.0
Firebase:
3.4.1
AngularFire:
2.0.0-beta.5
Other (e.g. Node, browser, operating system) (if applicable):
node: 6.5.0
os: darwin x64
angular-cli 1.0.0-beta.17
My previous issue was closed as I had not completed the template properly, also please note I did raise this initially on stackoverflow as I believed it was something I was doing wrong.
This is not similar to issue #582 as it is not about General Userdata.
This is about being able to access the authenticated user's (providers) accessToken as was possible in AngularFire1.
So on initial login (with Google set as AuthProvider):
this.af.auth.subscribe(user=> { if (user) { console.log(user.google); }
This will log the uid, accessToken & provider
The accessToken property is not accessible.
On a page refresh the above will log out uid, displayName, email, and photoURL
These are available at all times.
My point/request is that the provider's accessToken is made available.
This property is available on the standard Firebase JS API.
@adriandurran The access token is not accessible because it is not available in onAuthStateChanged in the underlying Firebase SDK. This is because it is not guaranteed to be a fresh token as it will expire after a few hours. You can keep it around in memory (or localStorage) yourself if needed, but we will not be adding it as it would break functionality with the underlying SDK.
@davideast What is the proper way to get the idToken and accessToken with AngularFire2 then? Firebase seems to be storing them in localStorage. Should we just be using the Firebase SDK directly if we need them?
@Splaktar I am using the Firebase SDK directly to get the token.