Why can't I retrieve emails addresses and phone numbers with Google People API?

后端 未结 5 1933
有刺的猬
有刺的猬 2020-12-29 00:59

I want to retrieve my contacts names, email address and phone numbers using the Google People API and I\'m using their Try it! tool to test the API.

The name

5条回答
  •  忘掉有多难
    2020-12-29 01:24

    User's phone numbers and other details will be fetched only if the user has added them to their Google profile.

    If you are using Try this API tool and with 'resourceName = people/me', then :

    1. you should be logged in with your Google account and
    2. give your consent to allow the google API explorer tool to access logged in user's (in this case your) profile details. See example here.

    After the consent is given by you, it will be able to fetch 'phoneNumbers' and 'addresses' for the logged in user.

    If you want to access other user's profile or you are calling the API from any other source then:

    1. the user must give permission to your app/website/program to access the requested information from his/her profile

    2. you must include 'authorization' KEY in GET REQUEST HEADERS with VALUE "Bearer (OAuth accesstoken of the target user)" to get personal details from the target user's profile.

    The OAuth accesstoken can be obtained directly from the user consent response or by exchanging refreshtoken for accesstoken.

提交回复
热议问题