All Google Health API endpoints that read and write user data require user consent to that data collection through one or more scopes. The app must provide the list of scopes when calling Google's OAuth2 auth endpoint. See Obtaining OAuth2 Access Tokens. The access token issued will only contain the scopes the consenting user has authorized.
All Google Health API scopes begin with:
https://www.googleapis.com/auth/googlehealth
Implementation
To provide the best user experience and ensure security compliance, when requesting scopes you should:
- Only request the scopes needed: Only request access to the specific data scopes your application requires to function.
- Configure write access only when sending data: Only configure "write"
access (for example, using a
writeonlyscope) if you are sending data to Google Health. - Handle partial consent gracefully: Your application should not fail
if a user does not select all scopes presented on the consent screen.
- If your application requires all presented scopes to function, you can present the text: "For the best user experience, we recommend enabling all scopes."
Available scopes
| Scope | Permission |
|---|---|
| .activity_and_fitness.readonly | See your Google Health activity and fitness data. |
| .activity_and_fitness.writeonly | Add activity and fitness data to Google Health, and edit or delete the data it adds. |
| .ecg.readonly | See your Google Health ECG data. |
| .health_metrics_and_measurements.readonly | See your Google Health health metrics and measurement data. |
| .health_metrics_and_measurements.writeonly | Add health metric and measurements data to Google Health, and edit or delete the data it adds. |
| .irn.readonly | See your Google Health Irregular Rhythm Notifications data. |
| .location.readonly | See your Google Health GPS location recorded during an exercise. |
| .nutrition.readonly | See your Google Health nutrition data. |
| .nutrition.writeonly | Add nutrition data to Google Health, and edit or delete the data it adds. |
| .profile.readonly | See your Google Health profile data. |
| .profile.writeonly | Add profile data to Google Health, and edit or delete the data it adds. |
| .settings.readonly | See your Google Health settings. |
| .settings.writeonly | Add settings data to Google Health, and edit or delete the data it adds. |
| .sleep.readonly | See your Google Health sleep data. |
| .sleep.writeonly | Add sleep data to Google Health, and edit or delete the data it adds. |