Reputation: 21
gapi.client.people.people.connections.list({
'resourceName': 'people/me',
'pageSize': 120,
'personFields': 'names,phoneNumbers,emailAddresses'
})
[i already specify emailAddresses as one of my personfields but i dont see email address in the response as shown below.this is the response in console.
Upvotes: 2
Views: 886
Reputation: 1106
Ok I found the answer to this. The problem was in defining the SCOPE for your call. I am using the google.accounts.oauth2.initTokenClient method of asking for user authorization (see a slightly different example here)
So, this was the correct way of asking for authentication:
this._googleTokenClient = google.accounts.oauth2.initTokenClient({
client_id: this._googleClientId,
scope: "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
callback: '',
});
See the TWO scopes I requested.
Upvotes: 0
Reputation: 207
The required scope for these fields are:
https://www.googleapis.com/auth/user.phonenumbers.read https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email
Upvotes: -1
Reputation: 518
Maybe check if your scopes allow you access to email addresses and if that contact actually has an email address. I believe the API doesn't even add a field if it's empty, rather than populating a field with an empty value.
Upvotes: -1