Skip to content

fix(portal): ask the identity provider for the account chooser and hint the tenant domain - #962

Open
ramybarsoum wants to merge 1 commit into
yc-software:mainfrom
ramybarsoum:oidc-account-chooser
Open

fix(portal): ask the identity provider for the account chooser and hint the tenant domain#962
ramybarsoum wants to merge 1 commit into
yc-software:mainfrom
ramybarsoum:oidc-account-chooser

Conversation

@ramybarsoum

@ramybarsoum ramybarsoum commented Sep 6, 2026

Copy link
Copy Markdown

Problem

When the portal runs against Google as the OIDC issuer, the authorize request carries neither prompt nor hd. Google therefore reuses whichever account the browser is already signed into. If that account is outside OIDC_ALLOWED_EMAIL_DOMAIN, the user is refused after the round trip with no way to pick a different account, and every retry repeats the same auto-selection.

Change

  • plugins/portal/src/oidc.ts: OidcConfig gains optional prompt and hostedDomain. buildAuthorizeUrl forwards them as prompt= and hd= only when set. New hostedDomainHint(issuer, allowedEmailDomain) returns the hint only for the Google issuer with a domain gate configured.
  • plugins/portal/src/index.ts: prompt comes from a new optional OIDC_PROMPT env var; hostedDomain comes from hostedDomainHint.
  • cli/src/services.ts: OIDC_PROMPT added to the portal's Fly stack keys so a stack can set it.
  • Tests: the default authorize URL carries neither parameter; a Google configuration carries both; hostedDomainHint covers Google with a domain, Google without a domain, and a non-Google issuer with a domain.

Both hints are opt-in and absent by default, so the Slack issuer and existing deployments are unchanged. hd is a chooser hint only; server-side domain enforcement is untouched.

Verification

plugins/portal: 116/116 tests pass; plugins/portal and cli typechecks pass. No rendered surface changes; the only user-visible effect is Google's own account chooser appearing when OIDC_PROMPT=select_account is configured.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…nt the tenant domain

Google reuses whichever account the browser is signed into, and when that
account fails the OIDC_ALLOWED_EMAIL_DOMAIN gate the user is refused with
no way to pick another one. The portal now forwards OIDC_PROMPT as the
prompt parameter when it is configured, and for the Google issuer sends
OIDC_ALLOWED_EMAIL_DOMAIN as the hd hint so the chooser opens filtered to
the tenant. Both hints are opt-in and absent by default; server-side
domain enforcement is unchanged. hostedDomainHint() holds the issuer
gate so both paths are unit-tested, and OIDC_PROMPT joins the portal's
Fly stack keys.
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