Skip to content

fix(auth): pass username argument to OAuth2Flow#60

Open
chilang wants to merge 1 commit intoxdevplatform:mainfrom
chilang:fix/oauth2-username-passthrough
Open

fix(auth): pass username argument to OAuth2Flow#60
chilang wants to merge 1 commit intoxdevplatform:mainfrom
chilang:fix/oauth2-username-passthrough

Conversation

@chilang
Copy link
Copy Markdown

@chilang chilang commented Apr 10, 2026

Summary

  • auth oauth2 always passes "" to OAuth2Flow(), ignoring any positional USERNAME argument
  • This forces the flow through fetchUsername()GET /2/users/me, which has been returning 403 for many developers since the March 2026 platform regression
  • When a username is provided (xurl auth oauth2 alice), it should be passed through so OAuth2Flow skips the broken lookup and stores the token directly

Changes

One-line fix in cli/auth.go: read args[0] when present and pass it to a.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 (calls fetchUsername)
  • xurl auth status shows the token stored under the provided username
  • xurl whoami works with the stored token

Fixes #47

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
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 10, 2026

CLA assistant check
All committers have signed the CLA.

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.

OAuth2 authentication failed: Auth Error: UsernameNotFound (cause: username not found when fetching username)

2 participants