You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add authorization code flow fallback for Google Calendar/Gmail
Google's device code flow only supports 7 scopes — Calendar and Gmail
scopes are not among them. The bridge now selects the auth flow per
capability based on scope compatibility:
- Device code flow (RFC 8628) for scopes in Google's allowlist
- Authorization code flow with loopback redirect (http://localhost) for
all other scopes (Calendar, Gmail)
auth_complete now exchanges the authorization code for tokens via the
token endpoint instead of storing the raw code. A flow_type guard
prevents auth_complete from being called on device_code flows.
The OAuth client must be "Desktop" type to support authorization code
flow with loopback redirects.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
-**Token endpoint**: `POST https://oauth2.googleapis.com/token` with `grant_type=urn:ietf:params:oauth:grant-type:device_code`.
297
+
-**Client type**: "Desktop" type in Google Cloud Console (supports authorization code flow with loopback redirect for all scopes).
298
+
-**Flow selection**: The bridge selects flow type per capability based on scope compatibility:
299
+
-**Device code flow** (RFC 8628): Only for scopes in Google's device code allowlist (`email`, `openid`, `profile`, `drive.appdata`, `drive.file`, `youtube`, `youtube.readonly`).
300
+
-**Authorization code flow** (loopback redirect): For all other scopes, including Calendar (`calendar`) and Gmail (`gmail.readonly`, `gmail.send`). User gets a URL, opens it in their browser, approves, and pastes the redirect URL containing the auth code.
301
+
-**Scopes**: `gmail.readonly`, `gmail.send`, `calendar` — all use authorization code flow since none are in the device code allowlist.
302
+
-**Device code endpoint**: `POST https://oauth2.googleapis.com/device/code` (only for device-code-compatible scopes).
-**Token endpoint**: `POST https://oauth2.googleapis.com/token` with `grant_type=urn:ietf:params:oauth:grant-type:device_code` or `grant_type=authorization_code`.
305
+
-**Redirect URI**: `http://localhost` — standard loopback redirect for headless/CLI tools. After consent, Google redirects to localhost (nothing listening), but the URL bar contains `?code=AUTH_CODE` for the user to copy.
301
306
-**Token refresh**: bridge refreshes expired access tokens before invoke operations.
302
307
-**Storage**: access_token + refresh_token in vault via `FileVault.put_json`, keyed by `(user_id, capability_id, account_ref)`.
303
308
-**Config**: `google_client_id` / `google_client_secret` in `[skills.google]`, passed to bridge via env vars.
Copy file name to clipboardExpand all lines: src/ash/skills/bundled/gog/README.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,8 @@ gogcli bridge
16
16
17
17
## Getting Started
18
18
19
+
**Prerequisite**: Your Google Cloud OAuth client must be "Desktop" type (not "TVs and Limited Input devices"). Desktop clients support authorization code flow with loopback redirects, which is required for Calendar and Gmail scopes.
0 commit comments