feat: discovery-driven OIDC auth with device code & refresh token flows#5
feat: discovery-driven OIDC auth with device code & refresh token flows#5alukach wants to merge 23 commits into
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…delete error handling Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e login/creds flow
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…letes - Drop unused OidcDiscovery/TokenResponse fields and the FlowType::Auto variant (it always resolved to AuthCode); default --flow is now auth-code. - Remove verbose JWT-claims decode block from run_login. - Inline issuer_key and merge delete_refresh_token/delete_credentials into a shared delete_entry helper. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The committed staging CLIENT_ID (c445cc61…) does not exist in the staging Ory project; auth.staging.source.coop returns invalid_client for it. The real source-coop-cli client is a79c9537-be78-454a-9ea1-b96a1be811cc. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Source it (`source .env.staging`) to override issuer/client/proxy via the existing SOURCE_* env vars — no rebuild needed. Values are public (OIDC public client + public URLs). Ignore other .env files to avoid committing secrets. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Device-code login is blocked: Ory Network silently drops the urls.device.verification/success project-config keys, so Hydra can't be pointed at a custom verification UI. Captures what works, how it fails, root cause, and the ask. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Symptom: with #6's corrected prod client ( Clues:
Best guess (low confidence): the double-loaded This PR's device-code flow would sidestep the browser consent + loopback entirely (also ideal for headless/CI), so it looks like the clean unblock. Does Happy to test against catalog publishing — just point at a branch. Thanks for the work here. [this comment written by Claude Opus 4.8 and approved by @saulpw] |
|
Thanks @saulbert. I'm not familiar with a "spins forever" bug. #6 has since been merged, I recommend you try again off of I would like to get this PR working but for the reasons described in Ory Network:
|
What this works toward
Replaces the CLI's single hardcoded auth flow (Authorization Code + PKCE) with a discovery-driven OIDC system for Source Cooperative. The CLI now reads the provider's OIDC discovery document and selects the best available flow, and AWS credentials refresh themselves silently.
Design doc:
docs/plans/2026-03-12-oidc-discovery-auth-design.mdChanges
OIDC discovery drives flow selection
.well-known/openid-configurationand reads real capabilities (endpoints,grant_types_supported) instead of hardcoding.oidc.rsis restructured into anoidc/module.Three auth flows instead of one
auth_code.rs; needs a browser on the same machine.--flowflag > device-code (if supported) > auth-code. Each flow returns an ID token, then the unchanged STS step performsAssumeRoleWithWebIdentity.Refresh tokens cached + auto-refresh
offline_accessscope and stores the refresh token in a separate keyring entry (file fallback, keyed by issuer).source-coop credssilently exchanges the refresh token for a new ID token → new AWS creds when the cached creds are expired.--no-refreshopts out.New
logoutcommandResult
One CLI that works on a laptop or a headless box, with credentials that quietly renew until the refresh token is revoked.
Status
Draft — still wiring up / debugging (recent commits add
proxy_url/role_arnto refresh data and debug logging).🤖 Generated with Claude Code