fix(tui): copy oauth url when no device code #7812
Merged
+1
−2
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
Fixes #7838 by updating the
ccopy handler in the OAuth auto dialog to:authorization.instructionsauthorization.url(the long authorize URL)No other behavior changes. This makes
c copyconsistently 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 copyhint. Pressingcpreviously copiedauthorization.instructionsunless a device code (e.g.ABCD-EFGH) was detected inside it. For example ...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
ccopied that sentence instead of the actual authorize URL, from this ...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).