How to access user Google Fit data from backend

Viewed 974

I write backend ASP .NET Core API and I need to read user Google Fit data.

I created an Android app that gets the server auth code and sends it to backend. As far as I understand, I need to get user token and then use it to access Google Fit. I tried to find libraries for it and failed. I also tried to get user token using Postman and got the following error:

{
    "error": "invalid_grant",
    "error_description": "Bad Request"
}

Am I doing something wrong?

1 Answers

You may refer with this thread: Using google fit api from a backend server.

To access from a back end server you will need to use the Rest API's There is documentation at developers.google.com/fit. You should be aware that the Google servers and the Android device are synced irregularly so data on the device may not be visible for hours or even days.

You may also check this link on how to read user's Google Fit data via REST API.

There is a mechanism for Android apps to obtain offline access for web back-ends highlighted in the CrossClientAuth guide from your question. With offline access, you can theoretically serve or store that data in any way that the user has consented to. Any access controls of that data to another person is something that you'd have to handle on your own.

Related