Skip to content

fix(auth): pass client credentials to OAuth2 token refresh - #35

Open
Itsriober wants to merge 1 commit into
zcaceres:mainfrom
Itsriober:fix/oauth-client-id-token-refresh
Open

fix(auth): pass client credentials to OAuth2 token refresh#35
Itsriober wants to merge 1 commit into
zcaceres:mainfrom
Itsriober:fix/oauth-client-id-token-refresh

Conversation

@Itsriober

@Itsriober Itsriober commented Jul 22, 2026

Copy link
Copy Markdown

The OAuth2 client is constructed with new google.auth.OAuth2() — no client_id or client_secret. This works while the initial access token is valid, but once it expires, the automatic refresh request to Google's token endpoint fails with invalid_request: Could not determine client ID from request., and every tool call fails despite a valid refresh token on disk.

Fix: read client_id, client_secret, and redirect_uris from gcp-oauth.keys.json and pass them to the OAuth2 constructor. Persist refreshed tokens back to the credentials file via the tokens event so later runs reuse the refreshed token and pick up a rotated refresh token if Google issues one.

Verified against a real expired token: reproduced the invalid_request failure with the old construction, then confirmed a live call to tasks.tasklists.list() succeeds and the tokens event fires with a refreshed access token.

Related to #34 (separate bug, same server), but independent of it.

The OAuth2 client was constructed without client_id or client_secret, so once the saved access token expired, the automatic refresh request to Google's token endpoint failed with invalid_request: Could not determine client ID from request. Every tool call then failed despite a valid refresh token being present. Read client_id, client_secret, and redirect_uris from gcp-oauth.keys.json and pass them to the OAuth2 constructor, and persist refreshed tokens back to the credentials file so future runs reuse them instead of hitting the network.
@Itsriober
Itsriober force-pushed the fix/oauth-client-id-token-refresh branch from a75f8c1 to b7759ca Compare July 22, 2026 05:30
@Itsriober Itsriober changed the title fix: pass client_id/client_secret to OAuth2 client for token refresh fix(auth): pass client credentials to OAuth2 token refresh Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant