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
{{ message }}
Repository navigation
Bug: raw calendar.events.list fails with insufficient scopes; +agenda helper succeeds with the same account #861
Bug: raw calendar.events.list fails with insufficient scopes; +agenda helper succeeds with the same account
gws version: 0.22.5 (reproduced on both the plugin-bundled binary and the @googleworkspace/cli npm package, same version) OS: macOS (darwin-arm64) Auth method: oauth2, interactive browser login (not token_env_var)
Repro
gws calendar events list --params '{"calendarId":"primary","timeMin":"2026-07-03T00:00:00Z","timeMax":"2026-07-04T23:59:59Z","singleEvents":true,"maxResults":1}'
Fails every time with:
error[api]: Request had insufficient authentication scopes.
This happens even immediately after a fresh interactive OAuth consent grant that explicitly includes https://www.googleapis.com/auth/calendar, confirmed via gws auth status (token_valid: true, has_refresh_token: true, scope list includes calendar).
What works, same account, same underlying operation
gws calendar +agenda --today — succeeds, returns real events (including from the primary/self calendar).
Google Calendar API events.list called through a separate OAuth client (a different tool wired to the same Google account) — succeeds with equivalent params.
Ruled out
Not the calendarId alias — fails identically with "primary" and with the literal calendar ID (user@domain.com).
Not the date range — fails identically for a 2024 range and a current-date range.
Not a stale/cached token — fails immediately after a fresh interactive consent grant (each invocation re-triggers the consent screen and still fails afterward).
Not a version mismatch — confirmed identical version (0.22.5) across two independently installed copies of the binary.
Impact
Any raw <service> <resource> <method> call to calendar.events.list is unusable; only the +agenda helper works, and it only supports relative/forward date windows (--today, --tomorrow, --days N), not arbitrary historical ranges. This blocks any integration that needs calendar events for a specific past date range (e.g. weekly backfills).
Neither is an exact match: both describe general/all-API breakage, while this report isolates the failure to the raw events.list method path specifically, with the +agenda helper and a separate OAuth client succeeding on the identical account and data.
Because +agenda succeeds, the most useful comparison is the exact credential/scopes object and API request path selected by the helper versus the generated raw command. Instrumenting both just before dispatch (redacting tokens) should reveal whether raw discovery metadata requests a narrower scope, chooses a different auth profile, or omits the refreshed credential. A regression can stub events.list and assert both routes resolve the same calendar OAuth scope while still allowing helpers to request extra scopes when genuinely needed.
Additional macOS reproduction (gws 0.22.5, interactive OAuth, Google Workspace account):
Ran gws auth login --scopes https://www.googleapis.com/auth/calendar and completed consent.
gws auth status reports auth_method: oauth2, a valid token and refresh token, and the full https://www.googleapis.com/auth/calendar scope.
Raw gws calendar events list still returns 403 Request had insufficient authentication scopes.
Unlike the report's workaround, gws calendar +agenda --today also fails here. Its error details identify calendar.v3.CalendarList.List / calendar-json.googleapis.com with ACCESS_TOKEN_SCOPE_INSUFFICIENT.
This was reproduced after a fresh reauthorization. I redacted all account and calendar IDs.
Activity
hiSandog commentedon Jul 11, 2026
Because
+agendasucceeds, the most useful comparison is the exact credential/scopes object and API request path selected by the helper versus the generated raw command. Instrumenting both just before dispatch (redacting tokens) should reveal whether raw discovery metadata requests a narrower scope, chooses a different auth profile, or omits the refreshed credential. A regression can stubevents.listand assert both routes resolve the same calendar OAuth scope while still allowing helpers to request extra scopes when genuinely needed.cassiexflowceo commentedon Aug 28, 2026
Additional macOS reproduction (gws 0.22.5, interactive OAuth, Google Workspace account):
gws auth login --scopes https://www.googleapis.com/auth/calendarand completed consent.gws auth statusreportsauth_method: oauth2, a valid token and refresh token, and the fullhttps://www.googleapis.com/auth/calendarscope.gws calendar events liststill returns403 Request had insufficient authentication scopes.gws calendar +agenda --todayalso fails here. Its error details identifycalendar.v3.CalendarList.List/calendar-json.googleapis.comwithACCESS_TOKEN_SCOPE_INSUFFICIENT.This was reproduced after a fresh reauthorization. I redacted all account and calendar IDs.
mateus-maia-dd commentedon Aug 28, 2026
@cassiexflowceo I opened a PR but I guess they are not active looking unfortunately.
#870