Skip to content

Device code auth support#281

Open
anvilpete wants to merge 1 commit into
zed-industries:mainfrom
anvilpete:device-code-auth
Open

Device code auth support#281
anvilpete wants to merge 1 commit into
zed-industries:mainfrom
anvilpete:device-code-auth

Conversation

@anvilpete
Copy link
Copy Markdown
Contributor

This PR adds device code auth support for ChatGPT login when no browser is available.

Ideally this should use a URL Elicitation Required Error once the Elicitations RFD is approved. Instead it responds with Error::auth_required() with data: { message, url, user_code }. Happy to change this to a URLElicitationRequiredError if you prefer that.

I didn't add an equivalent of the optional elicitation/complete notification, as our client doesn't require this. But I can do if you like.

It requires the client to advertise "clientCapabilities": {"_meta": {"codex-acp": {"deviceCodeAuth": true } } }, to avoid breaking any assumptions in existing client implementations.

Comment thread src/codex_agent.rs
cx.spawn(async move {
responder.respond_with_result(agent.authenticate(request).await)
responder
.respond_with_result(agent.authenticate(request, auth_cx).await)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cx is passed in here to allow the handler to spawn a complete_device_code_login() task. We could perhaps pass a narrower spawner trait instead, or maybe even return a Future from the handler.

Comment thread README.md
- Custom Prompts
- Client MCP servers
- Auth Methods:
- ChatGPT subscription (requires paid subscription and doesn't work in remote projects)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Paid subscriptions aren't required.. maybe they were at some point in the past?

@anvilpete
Copy link
Copy Markdown
Contributor Author

Support for #149

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.

1 participant