Skip to content

Conversation

@itskingori
Copy link
Contributor

@itskingori itskingori commented Jan 11, 2026

Summary

Fixes #7838 by updating the c copy handler in the OAuth auto dialog to:

  • Copy the device code if one exists in authorization.instructions
  • Otherwise copy authorization.url (the long authorize URL)

No other behavior changes. This makes c copy consistently copy the thing you actually need to paste into the browser e.g. Copilot: copies the device code and ChatGPT Plus/Pro copies the full authorize URL.

Context

When connecting providers that use the OAuth "auto" flow in the TUI, OpenCode shows a URL, an instruction line, and a c copy hint. Pressing c previously copied authorization.instructions unless a device code (e.g. ABCD-EFGH) was detected inside it. For example ...

Login with GitHub Copilot
https://github.com/login/device
Enter code: [REDACTED]
Waiting for authorization...
c copy 

This worked for device-code style flows (e.g. GitHub Copilot), but for ChatGPT Plus/Pro the instructions are a generic sentence ("Complete authorization in your browser…"), so c copied that sentence instead of the actual authorize URL, from this ...

ChatGPT Pro/Plus
https://auth.openai.com/oauth/authorize?response_type=code&client_id=[REDACTED]&redirect_uri=http%3A%2F%2Flocalhost%3A1455%2Fauth%2Fcallback&scope=openid+profile+email+offline_access&code_challenge=[REDACTED]&code_challenge_method=S256&id_token_add_organizations=true&codex_cli_simplified_flow=true&state=[REDACTED]&originator=opencode
Complete authorization in your browser. This window will close automatically.
Waiting for authorization...
c copy 

Testing

I manually tested the TUI and confirmed what I expected was in the clipboard. Verified for Copilot and ChatGPT Plus/Pro ... I don't know if the other providers have flows outside what's mentioned here (and there are too many to manually check).

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@itskingori itskingori marked this pull request as ready for review January 11, 2026 16:10
@rekram1-node rekram1-node merged commit c526e2d into anomalyco:dev Jan 11, 2026
10 checks passed
zerone0x pushed a commit to zerone0x/opencode that referenced this pull request Jan 12, 2026
zerone0x pushed a commit to zerone0x/opencode that referenced this pull request Jan 12, 2026
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.

"c copy" in oauth dialog doesn't copy URL when no device code present

2 participants