[PR #6740] [CLOSED] feat(oidc-provider): support prompt=create #15104

Closed
opened 2026-04-13 09:49:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6740
Author: @gustavovalverde
Created: 12/13/2025
Status: Closed

Base: canaryHead: feat/oidc-prompt-create


📝 Commits (1)

  • d13cdd0 feat(oidc-provider): support prompt=create

📊 Changes

7 files changed (+108 additions, -6 deletions)

View changed files

📝 docs/content/docs/plugins/oidc-provider.mdx (+6 -0)
📝 packages/better-auth/src/plugins/oidc-provider/authorize.ts (+11 -2)
📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+7 -0)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+60 -0)
📝 packages/better-auth/src/plugins/oidc-provider/types.ts (+14 -1)
📝 packages/better-auth/src/plugins/oidc-provider/utils/prompt.test.ts (+3 -2)
📝 packages/better-auth/src/plugins/oidc-provider/utils/prompt.ts (+7 -1)

📄 Description

Summary

Implements OpenID Connect Prompt Create (prompt=create) support in the Better Auth OIDC Provider plugin to enable a sign-up-first onboarding experience via the standard /oauth2/authorize flow.

Closes #6737

Solution

This supports an "OIDC-first" onboarding UX where the relying party (an external app) never handles the user's password:

  1. The relying party initiates authorization with prompt=create (optionally login_hint):
    • /oauth2/authorize?...&prompt=create&login_hint=user@example.com
  2. If the user is not authenticated, Better Auth redirects to createAccountPage (or loginPage if not configured), preserving the query string so the UI can render sign-up-first.
  3. The user completes sign-up in the Better Auth-hosted UI.
  4. Once a session is created, Better Auth resumes the OIDC authorization flow and completes the redirect back to the relying party.

Note: prompt=create is treated as a UX routing hint in the OP. It does not create users "through OIDC parameters"; the actual user creation is performed by Better Auth's sign-up endpoint as part of the OP's UI flow.


Summary by cubic

Adds support for OIDC prompt=create to enable a sign-up-first flow via /oauth2/authorize. Unauthenticated requests with prompt=create now redirect to a dedicated sign-up page, improving onboarding.

  • New Features

    • Handle prompt=create by redirecting unauthenticated users to createAccountPage (falls back to loginPage). Preserves the original query string.
    • Added createAccountPage option to the OIDC provider config.
    • Updated metadata (prompt_values_supported) and prompt parsing to include create.
    • Docs and tests added for prompt=create behavior.
  • Migration

    • No breaking changes. Optionally set createAccountPage to use a dedicated sign-up route.

Written for commit d13cdd034e. Summary will update automatically on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/6740 **Author:** [@gustavovalverde](https://github.com/gustavovalverde) **Created:** 12/13/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `feat/oidc-prompt-create` --- ### 📝 Commits (1) - [`d13cdd0`](https://github.com/better-auth/better-auth/commit/d13cdd034ee4f3200abbfdd5ffb72ff703b5d432) feat(oidc-provider): support prompt=create ### 📊 Changes **7 files changed** (+108 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `docs/content/docs/plugins/oidc-provider.mdx` (+6 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/authorize.ts` (+11 -2) 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+7 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+60 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/types.ts` (+14 -1) 📝 `packages/better-auth/src/plugins/oidc-provider/utils/prompt.test.ts` (+3 -2) 📝 `packages/better-auth/src/plugins/oidc-provider/utils/prompt.ts` (+7 -1) </details> ### 📄 Description ## Summary Implements OpenID Connect Prompt Create (`prompt=create`) support in the Better Auth OIDC Provider plugin to enable a sign-up-first onboarding experience via the standard `/oauth2/authorize` flow. Closes #6737 ## Solution This supports an "OIDC-first" onboarding UX where the relying party (an external app) never handles the user's password: 1. The relying party initiates authorization with `prompt=create` (optionally `login_hint`): - `/oauth2/authorize?...&prompt=create&login_hint=user@example.com` 2. If the user is not authenticated, Better Auth redirects to `createAccountPage` (or `loginPage` if not configured), preserving the query string so the UI can render sign-up-first. 3. The user completes sign-up in the Better Auth-hosted UI. 4. Once a session is created, Better Auth resumes the OIDC authorization flow and completes the redirect back to the relying party. Note: `prompt=create` is treated as a UX routing hint in the OP. It does not create users "through OIDC parameters"; the actual user creation is performed by Better Auth's sign-up endpoint as part of the OP's UI flow. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds support for OIDC prompt=create to enable a sign-up-first flow via /oauth2/authorize. Unauthenticated requests with prompt=create now redirect to a dedicated sign-up page, improving onboarding. - New Features - Handle prompt=create by redirecting unauthenticated users to createAccountPage (falls back to loginPage). Preserves the original query string. - Added createAccountPage option to the OIDC provider config. - Updated metadata (prompt_values_supported) and prompt parsing to include create. - Docs and tests added for prompt=create behavior. - Migration - No breaking changes. Optionally set createAccountPage to use a dedicated sign-up route. <sup>Written for commit d13cdd034ee4f3200abbfdd5ffb72ff703b5d432. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-13 09:49:54 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#15104