How to get Email of friend using google+ api?

后端 未结 3 994
旧巷少年郎
旧巷少年郎 2021-01-26 04:49

Im creating an application to login in Google+ and get friends emails. Im authenticating succesfully and get token back , but when i fetch friends list , the user class of any s

相关标签:
3条回答
  • 2021-01-26 04:54

    The Google+ API only returns public information. So even if you are permitted to see a person's email address, it does not necessarily mean that the information is public and that it will be returned.

    Furthermore, the documentation at https://developers.google.com/+/api/latest/people/list only guarantees that the list of people returned will contain the person's

    • id
    • displayName
    • image
    • url

    and that to get other information about the person, you will need to do a people.get against that ID. But, again, note that you may still not get their email if that information isn't public.

    0 讨论(0)
  • 2021-01-26 04:58

    My first guess would be that it's a rights management issue. I remember when I asked for my Google API key, I had to mention what information I want to get.

    Could you check your API key settings in the Google Developer network and see if you need to enable it there?

    0 讨论(0)
  • 2021-01-26 05:18

    You could also use the Contacts v3 API to get friend's email addresses. You can cross map this to Google+ contacts by looking at the gContact:website element for the contact that comes back in the XML response:

    <gContact:website href='http://www.google.com/profiles/1234567890' rel='profile'/>
    

    In that element's href attribute, 1234567890 is the person identifier that would match the id field of the relevant person resource from people.list of the Google+ API.

    Note that the profile link is not guaranteed to come back for a contact entry. This occurs when the contact has not been linked to a Google+ profile.

    0 讨论(0)
提交回复
热议问题