fix(auth): pass client credentials to OAuth2 token refresh - #35
Open
Itsriober wants to merge 1 commit into
Open
Conversation
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
force-pushed
the
fix/oauth-client-id-token-refresh
branch
from
July 22, 2026 05:30
a75f8c1 to
b7759ca
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.