Skip to content

OIDC deployments cannot authorize a third-party application: the device grant is accounts-only (#81) - #89

Open
jan21deepak wants to merge 1 commit into
mainfrom
cursor/oidc-device-grant-7cd5
Open

OIDC deployments cannot authorize a third-party application: the device grant is accounts-only (#81)#89
jan21deepak wants to merge 1 commit into
mainfrom
cursor/oidc-device-grant-7cd5

Conversation

@jan21deepak

@jan21deepak jan21deepak commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Opened automatically by Cursor Forge as a same-repo PR on jan21deepak/omnigent
after the Cloud Agent pushed cursor/oidc-device-grant-7cd5 (not against an upstream parent).

Fixes #81.

Cursor agent: bc-ef0ddc19-7ffa-49f6-b9d2-ea207bc27cd5


Note

High Risk
Changes authentication consent gating, OIDC login/callback behavior, and session JWT claims—security-sensitive paths where a mistake could weaken device-grant phishing defenses or break OIDC logins.

Overview
Enables the RFC 8628 device grant on OIDC deployments (still opt-in via OMNIGENT_DEVICE_GRANT_ENABLED), so external clients can get scoped delegated tokens—not only accounts mode. First-party CLI/Slack keep using cli-login on OIDC; the design doc calls that out.

Consent anti-phishing is tightened for OIDC. The device consent page no longer trusts session iat (IdP silent SSO can mint a “fresh” cookie without user action). Sessions now carry optional auth_time when credentials were actually verified; accounts logins set it on password/magic/setup; OIDC sets it only when the IdP attests a fresh login via verified id_token auth_time. Consent requires auth_time ≥ grant.created_at. Every login bounce from consent uses reauth=1; OIDC /auth/login forwards that as prompt=login + max_age=0, and the callback 403s if a forced re-auth was requested but the IdP reused a session.

Mount policy and operator UX: unsupported_reason blocks header mode (no mintable session) and non-OIDC providers like GitHub (no prompt/auth_time). app.py evaluates this before the auth-router block so header-mode operators get a warning when the flag is set but /oauth/* cannot mount. return_to on consent bounces is URL-encoded so odd user_code values don’t break the round-trip.

Tests cover OIDC mount, GitHub refusal, reauth prompt forwarding, callback verification, and consent with proven vs unproven cookies.

Reviewed by Cursor Bugbot for commit 17e53eb. Bugbot is set up for automated code reviews on this repo. Configure here.

Enable RFC 8628 device authorization for OIDC deployments alongside
accounts mode, so third-party applications can receive scoped, revocable
delegated tokens instead of full session JWTs from the cli-ticket flow.

- Mount /oauth/* when unsupported_reason() passes (accounts + full OIDC)
- Refuse GitHub OAuth and header mode with clear startup warnings
- Gate consent on session auth_time, not iat (accounts login + OIDC callback)
- Forward reauth=1 to IdP as prompt=login + max_age=0; verify auth_time
- Add tests for OIDC mount, reauth prompt forwarding, and callback checks

Fixes #81

Co-authored-by: jan21deepak <jan21deepak@users.noreply.github.com>
@jan21deepak

Copy link
Copy Markdown
Owner Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 17e53eb. Configure here.

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.

OIDC deployments cannot authorize a third-party application: the device grant is accounts-only

2 participants