Handle Google offline OAuth refresh parameters - #258
Open
todor-roi wants to merge 1 commit into
Open
Conversation
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.
Summary
access_type=offlineandprompt=consentoffline_accessfrom the Google scope string to avoidinvalid_scopeReproduction
A clean local profile using Google OAuth with a scope string containing
offline_accesssends that scope through to Google. Google rejects the browser authorization request withinvalid_scope, so no authorization code exchange completes and no refresh token can be persisted.Fix
Google uses the authorization URL query parameter
access_type=offlinefor refresh-token issuance. This keeps existing behavior for non-Google issuers while translating the Google case toaccess_type=offline&prompt=consentand strippingoffline_accessfrom the scope parameter.Google's OAuth documentation notes that a refresh token is returned only when the initial authorization request sets
access_type=offline: https://developers.google.com/identity/protocols/oauth2/web-server#offlineTests
corepack pnpm exec prettier --check src/lib/node-oauth-client-provider.ts src/lib/node-oauth-client-provider.test.tscorepack pnpm test:unit -- src/lib/node-oauth-client-provider.test.tscorepack pnpm exec tscNote:
corepack pnpm checkstill fails on repo-wide pre-existing Prettier findings in untouched files on this Windows checkout.