Get current logged in user info (email or userid) from google fit API

偶尔善良 提交于 2020-03-26 03:58:49

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!