I am using Firebase to authenticate with GitHub, Twitter and Facebook and I know I can get the provider access token upon authenticating like so
firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Facebook Access Token. You can use it to access the Facebook API.
var token = result.credential.accessToken;
// The signed-in user info.
var user = result.user;
// ...
}
However I redirect the user to a secure area after authenticating with React Router 4, in this secure area I need to retrieve the providers access tokens so I can access GitHub, Twitter and Facebook API (for Twitter I also need to get the "secret" string).
I can set an authentication state observer (below) in the secure area to get basic user details, even which providers the user has linked, however this does not give me the access tokens that I need to connect to the respective provider APIs
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// User is signed in.
var displayName = user.displayName;
var providerData = user.providerData;
// ...
}
I should mention that I allow the user to link multiple auth providers so I need all of the access token (https://firebase.google.com/docs/auth/web/account-linking)
Thanks