To enable Google Fit integration for the EMOM Timer, you need to configure a Google Cloud Project and create OAuth 2.0 Credentials.
- A Google Account
- Access to Google Cloud Console
- Go to the Google Cloud Console.
- Click the project dropdown in the top bar and select "New Project".
- Name it "EMOM Timer" (or similar) and click Create.
- In the sidebar, go to APIs & Services > Library.
- Search for "Fitness API".
- Click on Fitness API and then click Enable.
- Go to APIs & Services > OAuth consent screen.
- Select External User Type (unless you are in a Google Workspace organization) and click Create.
- App Information:
- App Name:
EMOM Timer - User Support Email: Your email.
- App Name:
- Developer Contact Information: Your email.
- Click Save and Continue.
- Scopes:
- Click Add or Remove Scopes.
- Search for
fitness.activity.write(or manually addhttps://www.googleapis.com/auth/fitness.activity.write). - Select it and click Update.
- Click Save and Continue.
- Test Users:
- Since the app is in "Testing" mode, you MUST add the email addresses of any users (including yourself) who will try to log in.
- Click Add Users, enter emails, and click Add.
- Click Save and Continue.
- Go to APIs & Services > Credentials.
- Click + Create Credentials > OAuth client ID.
- Application Type: Select Web application.
- Name:
EMOM Timer Web Client. - Authorized JavaScript origins:
- Add the URLs where your app will run.
- Local Development:
http://localhost:3000(orhttp://127.0.0.1:3000) - Production (GitHub Pages):
https://<your-username>.github.io - IMPORTANT:
- No trailing slash:
http://localhost:3000/will fail. Usehttp://localhost:3000. - Protocol required: Must start with
http://orhttps://.
- No trailing slash:
- Click Create.
- Copy Your Client ID. (It will look like
123456789-abcdefg...apps.googleusercontent.com).
Tip
If http://localhost:3000 is still rejected, try using http://127.0.0.1:3000 instead, and ensure you access your app via that same URL in the browser.
-
Create a file named
.envin the root of your project (add this to.gitignore). -
Add your Client ID:
VITE_GOOGLE_CLIENT_ID=your-client-id-here
-
Restart your development server (
pnpm run dev).
If you are deploying via GitHub Actions, you need to set this as a secret:
- Go to your GitHub Repository > Settings > Secrets and variables > Actions.
- Click New repository secret.
- Name:
VITE_GOOGLE_CLIENT_ID - Value: Paste your Client ID.
- Ensure your build workflow passes this secret to the build command.
- Open the app.
- Go to Settings.
- Click Connect Google Fit.
- A Google popup should appear asking for permission.
- Once granted, the button should change to "Connected" and workouts will sync automatically on completion.