Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion client/src/components/GoogleAccountConnection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ const GoogleAccountConnection = ({ onMessage }) => {
<Link href="https://console.cloud.google.com/apis/credentials" target="_blank" rel="noreferrer">
Google Cloud Console
</Link>
. Use the redirect URI shown below when configuring the OAuth client.
. Use the redirect URI shown below when configuring the OAuth client. The{' '}
<Link href="https://github.com/jherforth/HomeGlow/blob/main/docs/guides/google-integration.md" target="_blank" rel="noreferrer">
Google integration guide
</Link>{' '}
walks through the setup, including the consent-screen setting that keeps the connection from expiring after 7 days.
</Typography>

<TextField
Expand Down
30 changes: 23 additions & 7 deletions docs/guides/google-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ ships no shared credentials, so nothing about your calendar or photos passes
through anyone else's project.

> **This takes about ten minutes**, and most of it is in the Google Cloud Console
> rather than HomeGlow. The two steps people miss are **enabling the right
> Photos API** (§2 — two have nearly identical names) and **the redirect URI
> scheme** (§3).
> rather than HomeGlow. The steps people miss are **enabling the right
> Photos API** (§2 — two have nearly identical names), **the redirect URI
> scheme** (§3), and **publishing the consent screen** (§4) — a setup left
> in Testing silently stops syncing after 7 days.

## 1. Create the OAuth client

Expand All @@ -23,7 +24,11 @@ In the [Google Cloud Console](https://console.cloud.google.com/):
1. Create a project, or pick an existing one.
2. **APIs & Services → OAuth consent screen.** Choose **External**, fill in the
app name and your email. You do **not** need to submit for verification —
see [Verification](#verification-and-what-it-does-not-mean) below.
see [Verification](#verification-and-what-it-does-not-mean) below. The user
type also decides token lifetime: an **Internal** app (Google Workspace
accounts only) has no Testing status, so its refresh tokens do not expire
after 7 days — but only accounts in your Workspace organization can connect
to it. A personal Gmail account must use External.
3. **APIs & Services → Credentials → Create Credentials → OAuth client ID.**
Application type: **Web application**.
4. Leave the redirect URI blank for now — HomeGlow will tell you exactly what to
Expand Down Expand Up @@ -76,7 +81,14 @@ Plain HTTP is fine without any of this if you reach HomeGlow at

## 4. Authorize

Click **Authorize with Google** and complete the consent screen in the popup.
1. **Publish the consent screen first.** In the Cloud Console, go to
**APIs & Services → OAuth consent screen** and click **Publish app** so the
status reads **In production**. A new app starts in *Testing*, where Google
expires refresh tokens after **7 days** — sync works for a week and then
silently stops, with new events simply not appearing. (Google may ask you to
fill in the app's branding details — homepage and privacy policy links —
before the Publish button is available.)
2. Click **Authorize with Google** and complete the consent screen in the popup.

Because the app is unverified, Google shows an **"unverified app"** warning. Choose
**Advanced → Go to \<your app\> (unsafe)** to continue. That warning is about
Expand All @@ -85,6 +97,10 @@ your project.

Once connected, the panel shows the account and what it granted.

> **If you publish after authorizing**, authorize again: a refresh token issued
> while the app was in Testing keeps its 7-day expiry even after you publish.
> Only a token minted after publishing lasts.

## 5. Calendars

**Calendar widget → settings → Add source → Google.** Calendar sources are
Expand Down Expand Up @@ -123,7 +139,7 @@ Two things do change under verification pressure, and both are worth knowing:
- **Publishing status affects token lifetime.** An app left in *Testing* issues
refresh tokens that expire after **7 days**, which will disconnect your display
every week. Set the consent screen to **In production** (this does not require
verification) so the connection persists.
verification) so the connection persists — see §4.

## Troubleshooting

Expand All @@ -133,4 +149,4 @@ Two things do change under verification pressure, and both are worth knowing:
| `Error 400: policy_enforced` | The Google account is enrolled in Advanced Protection, which refuses unverified apps. Use a different account. |
| Photo picking fails with a 403 | The **Photos Picker API** is not enabled — see §2. Note it is a different API from the similarly named Photos Library API; the error message names the one you are missing. |
| Connection drops every week | The OAuth consent screen is still in *Testing*. Set it to *In production*. |
| Calendar events do not appear | Check the calendar is selected in **Calendar sources**, and that the Google Calendar API is enabled. |
| Calendar events do not appear | Check the calendar is selected in **Calendar sources**, and that the Google Calendar API is enabled. If sync worked and then stopped after about a week, the refresh token expired — the consent screen is still in *Testing*. Set it to *In production* and re-authorize (see §4). |