fix(auth): pass username argument to OAuth2Flow#60
Open
chilang wants to merge 1 commit intoxdevplatform:mainfrom
Open
fix(auth): pass username argument to OAuth2Flow#60chilang wants to merge 1 commit intoxdevplatform:mainfrom
chilang wants to merge 1 commit intoxdevplatform:mainfrom
Conversation
The `auth oauth2` command always passes an empty string to `OAuth2Flow()`, ignoring any positional username argument. This forces the flow through `fetchUsername()` which calls `GET /2/users/me` — an endpoint that has been returning 403 for many developers since the March 2026 platform regression. When a username is provided (`xurl auth oauth2 alice`), pass it through so `OAuth2Flow` skips the broken `/2/users/me` lookup and stores the token under the given username directly. Fixes xdevplatform#47
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
auth oauth2always passes""toOAuth2Flow(), ignoring any positionalUSERNAMEargumentfetchUsername()→GET /2/users/me, which has been returning 403 for many developers since the March 2026 platform regressionxurl auth oauth2 alice), it should be passed through soOAuth2Flowskips the broken lookup and stores the token directlyChanges
One-line fix in
cli/auth.go: readargs[0]when present and pass it toa.OAuth2Flow(username)instead of hardcoded"".Test plan
xurl auth oauth2 <username>completes successfully (skips/2/users/me)xurl auth oauth2(no args) retains existing behavior (callsfetchUsername)xurl auth statusshows the token stored under the provided usernamexurl whoamiworks with the stored tokenFixes #47