Skip to content

feat(auth): add an opt-in device code flow to Direct OIDC login - #309

Open
balcsida wants to merge 2 commits into
mainfrom
feat/oidc-device-code
Open

balcsida wants to merge 2 commits into
mainfrom
feat/oidc-device-code

Conversation

@balcsida

@balcsida balcsida commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

oidc.deviceCode: true signs in with the RFC 8628 device grant instead of the loopback redirect, for SSH, devcontainers and other headless setups. Same oidc_pkce credential and refresh as the loopback flow.

Off by default and settings-only, because a device code is easier to phish: the login prompt never offers it, nothing falls back to it, and Pi shows the plain verification URL rather than verification_uri_complete, so you always compare the code yourself.

The IdP must publish a device_authorization_endpoint and allow the grant for the client. Ported to the Go extension as well. README has the details.

Refs jesset/pi-provider-litellm-oidc#3

Confidence Score: 5/5 · The PR appears safe to merge, with both previous findings addressed and no new actionable issues found.RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge, with both previous findings addressed and no new actionable issues found.

Summary

Adds opt-in device code login to Direct OIDC in TypeScript and Go.

  • Direct OIDC login can use a device code on headless machines.

Reviews (2) · Last reviewed commit: "fix(auth): follow RFC 8628 polling rules..." · Reviewed by Greptile

oidc.deviceCode: true signs in with the RFC 8628 device grant instead of
the loopback redirect, for SSH, devcontainers and other headless setups.
Off by default and settings-only, as a device code is easier to phish.
Ported to the Go extension as well.

Refs jesset/pi-provider-litellm-oidc#3
Comment thread src/index.ts Resolved
Comment thread src/index.ts Resolved
Two review findings on the device grant, both in the poll loop and both
mirrored in the Go port.

- The IdP's `interval` was only honored up to 60 seconds, and anything larger
  fell back to 5, so an IdP asking for 120 got polled 11 times a minute
  instead of once. RFC 8628 treats it as a minimum wait with no upper bound,
  so it is honored as given; one past the deadline expires the login, which is
  what the deadline check already did.
- A request that did not complete retried at the original pace, since only
  `slow_down` moved the interval. RFC 8628 requires polling to slow down after
  a connection timeout and recommends exponential backoff, so every transient
  failure now doubles the wait. A connection timeout arrives here as the same
  transient failure as a network error or a 5xx, so all of them back off and
  nothing new has to be threaded through the token helper.

Reported by Greptile on #309.
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