-
Notifications
You must be signed in to change notification settings - Fork 8.3k
feat: support headless authentication for chatgpt/codex #10890
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
| }, | ||
| }, | ||
| { | ||
| label: "ChatGPT Pro/Plus (headless)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codex defaults to this based on if it detects environment variables
https://github.com/openai/codex/blob/067922a734f4abb11ef3db7290daed4feeeda60c/codex-rs/core/src/env.rs#L25-L46
i wasnt sure about if that would work here because of how opencode has multiple clients, so i didn't include it
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
c3c1fa0 to
5ecc5f0
Compare
|
/review |
| grant_type: "authorization_code", | ||
| code: data.authorization_code, | ||
| redirect_uri: `${ISSUER}/deviceauth/callback`, | ||
| client_id: CLIENT_ID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: This token exchange fetch doesn't check if the response is OK before parsing JSON. The existing exchangeCodeForTokens function (line 109-125) properly checks response.ok and throws an error on failure. Consider reusing that function or adding similar error handling here to avoid silent failures or confusing errors when the token exchange fails.
|
i have no clue what is wrong with the tests 😭 |
|
Not ur fault |
|
@rekram1-node this issue is why i didnt want to remove the option to choose the flow: openai/codex#9253 |
This reverts commit 7c14206.
|
Yeah i gotchu I was playing w/ something shouldnt have committed |
What does this PR do?
opencode.device.auth.mov
add the option to use the device auth authorization method to sign in with chatgpt/codex subscription
closes #10421, closes #8274, and approved by dax on twitter

How did you verify your code works?
manual testing (in the video)
copied mostly off of the copilot implementation of a similar (not exactly the same for some reason?) pattern
opencode share url