sp-dev-fx-webparts/samples/react-google-fit
VesaJuvonen 7a79c47104 Removing unnecessary office product from the sample metadata 2021-12-10 19:55:32 +02:00
..
assets Removing unnecessary office product from the sample metadata 2021-12-10 19:55:32 +02:00
config Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
src Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
.editorconfig Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
.gitignore Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
.yo-rc.json Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
README.md Standardized readme 2021-11-21 02:51:08 -05:00
gulpfile.js Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
npm-shrinkwrap.json Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
package.json Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
tsconfig.json Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00
tslint.json Added sample react-google-fit (#755) 2019-02-09 12:10:15 +02:00

README.md

Google Fit information

Summary

This sample demonstrates the integration of Google Fit information with SharePoint Framework. The Google Fitness REST APIs allows developers to extend it further and create their own dashboards. Google Fitness REST APIs are useful if you have fitness app and you want to integrate your data with google fit or if you just want to collect Fitness data and display some information to the users. This web part helps to display the key fitness information (activity time spent, distance travelled, calories burned, step count) from the Google fit data source.

Web part preview

Generate OAuth 2.0 client ID

In order to use Google REST APIs, we need to generate an OAuth 2.0 client ID. Follow below procedure to generate it.

  1. Open Google API Console from here.
  2. Select any existing project or choose to create a new project.
  3. Click Continue.
    Create a new project
  4. Once the project is created, we will have to generate the credentials.
  5. Click "Go to credentials".
    Generate credentials
  6. Select the options as highlighted below:
    Add credentials to your project
  7. Click "What credentials do I need?".
  8. Under Authorized JavaScript origins, add SharePoint Online site url (e.g. https://contoso.sharepoint.com) or https://localhost:4321, if you are using SharePoint local workbench.
  9. Under Authorized redirect URI, add https://localhost:4321/auth/google/callback, if you are using SharePoint local workbench.
    Add authorized origins
  10. Click "Create OAuth client ID".
  11. Set up the OAuth 2.0 consent screen.
    Setup OAuth consent
  12. Click Continue.
  13. The Client id will be generated. Note it down to use in web part property.
    OAuth ClientId
  14. Click Done.

Configure the Web Part to use

  1. Add "Google Fit Activity Viewer" web part on SharePoint page.
  2. Edit the web part.
  3. Add above generated OAuth 2.0 client ID to "ClientId Field" web part property.
  4. Save the changes. SharePoint Run

NPM Packages Used

Below NPM package is used to develop this sample.

  1. react-google-authorize (https://www.npmjs.com/package/react-google-authorize)

Compatibility

SPFx 1.7.1 Node.js v8 Compatible with SharePoint Online Compatible with SharePoint 2019 Does not work with SharePoint 2016 (Feature Pack 2) Local Workbench Compatible Hosted Workbench Compatible

Applies to

Solution

Solution Author(s)
react-google-fit Nanddeep Nachan https://www.linkedin.com/in/nanddeepnachan/ (SharePoint Consultant, @NanddeepNachan)

Version history

Version Date Comments
1.0.0 January 14, 2019 Initial release

Prerequisites

  • SharePoint Online tenant
  • Site Collection created under the /sites/ or /

Minimal Path to Awesome

Features

This sample web part shows how adaptive cards can be used effectively with SharePoint Framework to render an image gallery with data stored in a SharePoint list.

  • Integrating Google Fit information
  • Consuming Google Fit REST APIs
  • Creating extensible services
  • Using @react-google-authorize

Help

We do not support samples, but this community is always willing to help, and we want to improve these samples. We use GitHub to track issues, which makes it easy for community members to volunteer their time and help resolve issues.

If you're having issues building the solution, please run spfx doctor from within the solution folder to diagnose incompatibility issues with your environment.

You can try looking at issues related to this sample to see if anybody else is having the same issues.

You can also try looking at discussions related to this sample and see what the community is saying.

If you encounter any issues while using this sample, create a new issue.

For questions regarding this sample, create a new question.

Finally, if you have an idea for improvement, make a suggestion.

Disclaimer

THIS CODE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.