Enabling Google Fit

by Scott Dilley - CTO 18 Jan 2022

Google Fit allows fundraisers to record and track fitness activity from their Android or iPhone, it is able to access the data both from 3rd party apps installed on a phone e.g. Strava as well as access the data that your phone captures on it's own e.g. Apple Health and Google Health.

Adding Google Fit to your website then allows fundraisers to then have this data sent directly to their fundraising pages where we can display things like Daily steps, Distances and Fitness Duration. The benefit being that Google Fit can access fitness activity data from many different data sources such as Fitbit, Strava etc

Enabling Google Fit requires a Google Cloud Account and also requires a verification process via Google which may or may not incur fees.

Follow these steps to request an OAuth 2.0 client ID for the Fitness API.

  1. Go to the Google API Console.
  2. Select a project, or create a new one.
  3. Click Continue to enable the Fitness API.
  4. Click Go to credentials.
  5. Click New credentials, then select OAuth Client ID.
  6. Under Application type, select Web application.
  7. Under Authorized JavaScript origins, enter the base URL of your site (e.g. https://www.funraisin.co).
  8. Under Authorized redirect URI, enter the URL of your site followed by /login/googlefit (e.g. https://www.funraisin.co/login/googlefit).
  9. Click Create. Your new OAuth 2.0 Client ID and secret appear in the list of IDs for your project. An OAuth 2.0 Client ID is a string of characters, something like this:

    780816631155-gbvyo1o7r2pn95qc4ei9d61io4uh48hl.apps.googleusercontent.com

Once you have your Client ID and Secret jump into Funraisin > Platform Setup > General Setup > Apps Settings and enter these under the Google Fit section.

Testing

As Google Fit API access requires verification from Google, if you wish to test the integration whilst that is happening you can add test users to your Google Console.

Click into OAuth Consent Screen in the Google Console whilst editing your project and you will see a section called "Test Users", simply add in the emails of those you wish to test the integration with and you will be able to then connect your Google Fit account to your Fundraising profile.

Applying for Verification

Google requires that any integration that accesses personal data go through verification so they can check that everything is in order. This link below explains how to submit your integration for verification.

https://support.google.com/cloud/answer/9110914#sensitive-restricted-scopes&zippy=%2Csteps-for-apps-requesting-sensitive-scopes%2Csteps-to-submit-your-app

Keep in mind that this process can take up to a month to get approved. Additionally, if you are going to be providing Google Fit integration for more than 100 users you will be required at some point to go through a Google Security Assessment which can occur annually and usually comes at a cost.