Link: https://sites.google.com/site/oauthgoog/Home/emaildisplayscope
From the link above I add the email scope
https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/userinfo.email
But I dont understand the following
Once you have a valid OAuth token, you can use it to make API calls to the Email Display API endpoint: https://www.googleapis.com/userinfo/email If the token is not valid, a 401 error will be returned. If the token is valid, then the user's Email address will be returned. The API will also return a boolean value to indicate whether Google has verified that the user owns that Email address. However most installed applications will ignore that value.
How to make a call to the Email Display API endpoint? Using https://www.googleapis.com/userinfo/email
Set your scopes to:
And use the endpoint:
https://www.googleapis.com/oauth2/v1/userinfo?alt=json
Usage:
get https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=youraccess_token
You will get JSON:
{ "id": "xx", "name": "xx", "given_name": "xx", "family_name": "xx", "link": "xx", "picture": "xx", "gender": "xx", "locale": "xx" }
The scopes have changed for Google+ Sign-In.
Set your scopes to:
https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/userinfo.email
The JavaScript calls look like this:
gapi.client.load('oauth2', 'v2', function() { gapi.client.oauth2.userinfo.get().execute(function(resp) { // Shows user email console.log(resp.email); }) }); gapi.client.load('plus', 'v1', function() { gapi.client.plus.people.get( {'userId' : 'me'} ).execute(function(resp) { // Shows profile information console.log(resp); }) });
More information https://developers.google.com/+.
Edit: Note that you do not need scopes for plus.me or userinfo.profile.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With