Skip to content

Conversation

@rgodha24
Copy link
Contributor

@rgodha24 rgodha24 commented Jan 27, 2026

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
Screenshot 2026-01-27 at 2 33 54 PM

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

@github-actions
Copy link
Contributor

Hey! Your PR title feat(codex auth): add support for device auth flow doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

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

},
},
{
label: "ChatGPT Pro/Plus (headless)",
Copy link
Contributor Author

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

@rgodha24 rgodha24 changed the title feat(codex auth): add support for device auth flow feat: support headless authentication for chatgpt/codex Jan 27, 2026
@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.

@rekram1-node
Copy link
Collaborator

/review

grant_type: "authorization_code",
code: data.authorization_code,
redirect_uri: `${ISSUER}/deviceauth/callback`,
client_id: CLIENT_ID,
Copy link
Contributor

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.

@rgodha24
Copy link
Contributor Author

i have no clue what is wrong with the tests 😭

@rekram1-node
Copy link
Collaborator

Not ur fault

@rgodha24
Copy link
Contributor Author

rgodha24 commented Jan 27, 2026

@rekram1-node this issue is why i didnt want to remove the option to choose the flow: openai/codex#9253

@rekram1-node
Copy link
Collaborator

Yeah i gotchu I was playing w/ something shouldnt have committed

@rekram1-node rekram1-node merged commit 898118b into anomalyco:dev Jan 28, 2026
4 checks passed
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.

[FEATURE]: OAuth Device Code flow for ChatGPT / Codex plans /connect doesnt work for openai when server is remote

2 participants