Search code examples
google-apigoogle-fitgoogle-apis-explorergoogle-people-apigoogle-fit-api

How to get userId for Google Fit API?


How to get userId for getting the activity data of the user from google fit API. GET https://www.googleapis.com/fitness/v1/users/userId/dataSources/dataSourceId I can able to get my data by replacing userId with me but I want to create an application for other users.


Solution

  • As stated in the documentation, the only supported value for the user id is "me".

    The identity of the user that "me" refers to is conveyed by the OAuth token you pass with your request.

    If you want to access the data for a user, they will need to grant an OAuth token to you.