Skip to content

feat(auth): env-guarded custom Ory Elements flow pages (all four flows)#428

Merged
huv1k merged 1 commit into
mainfrom
huv1k/ory-flows-env-guarded-pages
Jun 17, 2026
Merged

feat(auth): env-guarded custom Ory Elements flow pages (all four flows)#428
huv1k merged 1 commit into
mainfrom
huv1k/ory-flows-env-guarded-pages

Conversation

@huv1k

@huv1k huv1k commented Jun 17, 2026

Copy link
Copy Markdown
Member

Renders the login, registration, recovery, and verification Ory self-service flows with a custom @ory/elements-react UI served same-origin, so the whole flow (including preview deployments) stays on the visiting host. Gated by NEXT_PUBLIC_ORY_CUSTOM_UI: enabled on Preview + Staging, while on Production (unset) the pages redirect to the existing /sign-in, /sign-up, /forgot-password — and the gated same-origin Ory SDK proxy (/self-service, /sessions/whoami, …) is inert there, so the Auth.js + Hydra path is untouched. Extracts the UI from #414, extends it to all four flows (like #427), and swaps #414's PostHog gate for the plain env var. Adds @ory/elements-react + @ory/nextjs, src/configs/ory.ts, the component overrides (including a single-input CodeInput and flow-aware card header/footer), and the four flow pages.

Follow-ups (not in this PR): the @ory/nextjs preview-host patch (so the SDK URL honors the request host on Vercel previews rather than VERCEL_URL) is intentionally left out and will land separately. Ory/Hydra's server-side *_ui_url must also point at the dashboard origin for staging/preview to route here (terraform enable_custom_auth_ui); set NEXT_PUBLIC_ORY_CUSTOM_UI=true + NEXT_PUBLIC_ORY_SDK_URL in those envs.

@cla-bot cla-bot Bot added the cla-signed label Jun 17, 2026
@vercel

vercel Bot commented Jun 17, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jun 17, 2026 11:04am

Request Review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 63d4c564cc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/app/login/components/custom-card.tsx Outdated
Comment thread src/configs/ory.ts Outdated
Comment thread src/app/registration/page.tsx Outdated
Comment thread src/app/login/components/custom-code-input.tsx Outdated
Comment thread src/app/login/components/custom-sso-button.tsx Outdated
Render the login, registration, recovery, and verification self-service
flows with a custom @ory/elements-react UI served same-origin, so the whole
flow (including preview deployments) stays on the visiting host.

Gated by NEXT_PUBLIC_ORY_CUSTOM_UI: enabled on Preview + Staging; on
Production (unset) the pages redirect to the existing /sign-in, /sign-up,
/forgot-password. The same-origin Ory SDK proxy (/self-service, /sessions/
whoami, …) is gated by the same flag, so the Auth.js + Hydra path is
untouched in production.

Adds @ory/elements-react + @ory/nextjs, src/configs/ory.ts, the component
overrides (incl. a single-input CodeInput for recovery/verification codes
and <title>s on the SSO logos), and flow-aware card header/footer. Inlines
@ory/nextjs in the vitest config so its extensionless next/server import
resolves under tests.
@huv1k huv1k merged commit 08c6aaa into main Jun 17, 2026
13 checks passed
@huv1k huv1k deleted the huv1k/ory-flows-env-guarded-pages branch June 17, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants