[PR #8544] [CLOSED] fix(oauth-provider): support prompt=none per OIDC spec #24951

Closed
opened 2026-04-15 22:39:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8544
Author: @himself65
Created: 3/11/2026
Status: Closed

Base: canaryHead: fix/oauth-provider-prompt-none


📝 Commits (1)

  • e24463b fix(oauth-provider): support prompt=none per OIDC spec

📊 Changes

4 files changed (+150 additions, -2 deletions)

View changed files

📝 packages/oauth-provider/src/authorize.ts (+26 -0)
📝 packages/oauth-provider/src/metadata.test.ts (+7 -1)
📝 packages/oauth-provider/src/metadata.ts (+7 -1)
📝 packages/oauth-provider/src/oauth.test.ts (+110 -0)

📄 Description

Summary

Adds prompt=none support to the new @better-auth/oauth-provider plugin per the OIDC specification.

  • When prompt=none is set and the user has no active session, redirect to redirect_uri with error=login_required instead of the login page
  • When prompt=none is set and consent is needed, redirect to redirect_uri with error=consent_required instead of the consent page
  • Add "none" to prompt_values_supported in the OIDC discovery metadata

Context

PR #8398 (commit 9dff8c5) fixed redirect_uri validation for prompt=none in the old oidc-provider plugin (packages/better-auth/src/plugins/oidc-provider/), but the same feature was missing in the new @better-auth/oauth-provider package (packages/oauth-provider/). As noted in this comment, the fix was applied to the wrong plugin.

Note: The redirect_uri validation security concern from #8398 is already handled by the new plugin's existing flow — redirect_uri is validated against the registered client URIs before reaching the prompt=none check.

Closes #7700

Test plan

  • login_required error returned when user is not authenticated with prompt=none
  • consent_required error returned when consent is needed with prompt=none
  • Invalid redirect_uri is rejected (not used for error redirects)
  • Metadata advertises "none" in prompt_values_supported
  • All existing oauth-provider tests still pass (50/50)

🤖 Generated with Claude Code


🔄 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/8544 **Author:** [@himself65](https://github.com/himself65) **Created:** 3/11/2026 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/oauth-provider-prompt-none` --- ### 📝 Commits (1) - [`e24463b`](https://github.com/better-auth/better-auth/commit/e24463ba139d2d82c0137eafa86f86cb306b2877) fix(oauth-provider): support prompt=none per OIDC spec ### 📊 Changes **4 files changed** (+150 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `packages/oauth-provider/src/authorize.ts` (+26 -0) 📝 `packages/oauth-provider/src/metadata.test.ts` (+7 -1) 📝 `packages/oauth-provider/src/metadata.ts` (+7 -1) 📝 `packages/oauth-provider/src/oauth.test.ts` (+110 -0) </details> ### 📄 Description ## Summary Adds `prompt=none` support to the new `@better-auth/oauth-provider` plugin per the OIDC specification. - When `prompt=none` is set and the user has **no active session**, redirect to `redirect_uri` with `error=login_required` instead of the login page - When `prompt=none` is set and **consent is needed**, redirect to `redirect_uri` with `error=consent_required` instead of the consent page - Add `"none"` to `prompt_values_supported` in the OIDC discovery metadata ## Context PR #8398 (commit 9dff8c5) fixed `redirect_uri` validation for `prompt=none` in the **old** `oidc-provider` plugin (`packages/better-auth/src/plugins/oidc-provider/`), but the same feature was missing in the **new** `@better-auth/oauth-provider` package (`packages/oauth-provider/`). As noted in [this comment](https://github.com/better-auth/better-auth/issues/7700#issuecomment-4035862756), the fix was applied to the wrong plugin. Note: The `redirect_uri` validation security concern from #8398 is already handled by the new plugin's existing flow — `redirect_uri` is validated against the registered client URIs before reaching the `prompt=none` check. Closes #7700 ## Test plan - [x] `login_required` error returned when user is not authenticated with `prompt=none` - [x] `consent_required` error returned when consent is needed with `prompt=none` - [x] Invalid `redirect_uri` is rejected (not used for error redirects) - [x] Metadata advertises `"none"` in `prompt_values_supported` - [x] All existing oauth-provider tests still pass (50/50) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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-15 22:39:05 -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#24951