问题
I am integrating google fit APIs for tracking fitness activities and I need to display logged in user email, but I am not able to fetch user info like email or userid from google fit.
I have found https://developers.google.com/fit/rest/v1/reference/users/dataSources/get but I need to add userId and dataSourceId in request parameters which I am unable to find.
回答1:
You are looking at the wrong place.
The data you are looking for is under: People API v1.
Use the following scopes for oAuth:
https://www.googleapis.com/auth/userinfo.profile, https://www.googleapis.com/auth/userinfo.email
Following url to fetch data: https://people.googleapis.com/v1/people/me
A get call with access_token should be good for you. Enjoy :)
来源:https://stackoverflow.com/questions/57271875/get-current-logged-in-user-info-email-or-userid-from-google-fit-api