Skip to content

fix(desktop): correct user code extraction when URL contains colons#28837

Merged
Brendonovich merged 1 commit into
anomalyco:devfrom
OpeOginni:fix/desktop-oauth-code
May 22, 2026
Merged

fix(desktop): correct user code extraction when URL contains colons#28837
Brendonovich merged 1 commit into
anomalyco:devfrom
OpeOginni:fix/desktop-oauth-code

Conversation

@OpeOginni
Copy link
Copy Markdown
Contributor

@OpeOginni OpeOginni commented May 22, 2026

Issue for this PR

Closes #28834

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixed user code extraction in the desktop app's OAuth auto-view. The previous code used instructions.split(":")[1]?.trim(), which breaks when the instruction text contains multiple colons (e.g., xAI's Open https://accounts.x.ai/oauth2/device on any device and enter code: ABCD-1234). This caused garbled text like "//accounts.x.ai/oauth2/device on any device and enter code" to display instead of the actual code.

Changed to instructions.split(":").pop()?.trim() to always grab the final segment (the real user code) regardless of how many colons appear in the URL or instruction text.

How did you verify your code works?

  • Verified the fix resolves the broken display for xAI device-code OAuth.
  • Tested GitHub Copilot OAuth to confirm existing flows still work correctly and are not regressed.

Screenshots / recordings

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@OpeOginni OpeOginni requested a review from adamdotdevin as a code owner May 22, 2026 12:38
@Brendonovich Brendonovich merged commit 3cf955e into anomalyco:dev May 22, 2026
6 checks passed
@OpeOginni OpeOginni deleted the fix/desktop-oauth-code branch May 22, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Connecting to Grok On Desktop Using OAuth shows weird and incomplete instructions

2 participants