Tony
Tony

Reputation: 550

Firebase 3 - Additional Auth Scope Data

In the Firebase 3 documentation, they say you can grab additional scope data such as this one:

Optional: Specify additional OAuth 2.0 scopes that you want to request from the authentication provider. To add a scope, call addScope. For example: provider.addScope('https://www.googleapis.com/auth/plus.login');

Once authenicated, I can't find the data as part of the "user" object. Any idea how to pick that extra data ?

Thank you,

Upvotes: 6

Views: 6182

Answers (2)

Charl Kruger
Charl Kruger

Reputation: 160

I have tested this out and using Github as an example, was able to retrieve the user's email address only if the user's email address was set to public on github. Passing the user:email scope had not effect when the email address was set to private. e.g.

provider = new firebase.auth.GithubAuthProvider();
provider.addScope('user:email');

Upvotes: 2

bojeil
bojeil

Reputation: 30848

Firebase V3 will not return the additional requested data when additional OAuth 2.0 scopes are requested. What you need to do is retrieve the credential returned (signInWithPopup and getRedirectResult provide that) and then using the Google accessToken in the credential call the google api to request the additional data.

Upvotes: 2

Related Questions