fix: only try to refresh access tokens if we have a refresh token or an expiry time #594
+10
−7
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.
Motivation and Context
When connecting to the GitHub remote MCP server as an "OAuth App" client (as opposed to a "GitHub App" client), GitHub issues a persistent, non-expiring access token and no refresh token.
The current logic treats a lack of an expiry time as "the token is already expired", which is incorrect in this use case, as the token never expires, and we are unable to refresh it (as we were never issued a refresh token).
This fixes the issue by only attempting to refresh if we have either a refresh token or an expiry time.
How Has This Been Tested?
Tested it with a local build of Warp, and verified that instead of getting
OAuth token refresh failed: No refresh token availableerrors, we now are able to properly make an authenticated connection to the GitHub remote MCP server.Breaking Changes
No, this is not a breaking API change, and should not break any functional behavior.
Types of changes
Checklist
Additional context