[PR #5848] [MERGED] fix(odic): case when prompt=login #23176

Closed
opened 2026-04-15 21:31:59 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5848
Author: @himself65
Created: 11/8/2025
Status: Merged
Merged: 11/10/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/11/07/odic


📝 Commits (6)

📊 Changes

7 files changed (+191 additions, -23 deletions)

View changed files

📝 packages/better-auth/src/plugins/oidc-provider/authorize.ts (+19 -7)
packages/better-auth/src/plugins/oidc-provider/error.ts (+13 -0)
📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+38 -4)
packages/better-auth/src/plugins/oidc-provider/middlewares/check-prompt.ts (+18 -0)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+4 -12)
packages/better-auth/src/plugins/oidc-provider/utils/prompt.test.ts (+69 -0)
packages/better-auth/src/plugins/oidc-provider/utils/prompt.ts (+30 -0)

📄 Description

Summary by cubic

Fixes OIDC prompt=login handling to always reauthenticate, prevents redirect loops after login, and adds spec‑compliant prompt parsing. Adds safer cookie parsing and a more robust login redirect URL.

  • Bug Fixes
    • Force reauth when prompt=login or no session; set signed cookie and redirect to the login page.
    • After login, mark oidcLoginPromptHandled to continue authorization without another redirect.
    • Parse and validate prompt per OIDC (login/consent/select_account/none); reject invalid combos with InvalidRequest.
    • Safely parse oidc_login_prompt cookie and preserve query params when redirecting; handle empty query strings.

Written for commit 8d7b28d3d5. 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/5848 **Author:** [@himself65](https://github.com/himself65) **Created:** 11/8/2025 **Status:** ✅ Merged **Merged:** 11/10/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/11/07/odic` --- ### 📝 Commits (6) - [`e6a853e`](https://github.com/better-auth/better-auth/commit/e6a853efc7c6e056014da4b20d947c9d0f4c4737) fix(odic): case when `prompt=login` - [`5d999c3`](https://github.com/better-auth/better-auth/commit/5d999c3141483bc1ca439159ef797fb41b9a9218) fix: parse - [`42e66c2`](https://github.com/better-auth/better-auth/commit/42e66c26612e97758808e7f889ffdc5120443c5b) feat(odic): implement prompt parsing functionality with tests - [`ec2dffa`](https://github.com/better-auth/better-auth/commit/ec2dffa7c86238fa8d814216816ec213a330b1d2) fix: prompt set - [`72cf3d1`](https://github.com/better-auth/better-auth/commit/72cf3d132a8fa09f86f6fd0d69e38108ee39a56e) fix: code - [`8d7b28d`](https://github.com/better-auth/better-auth/commit/8d7b28d3d510cf0621b000843d305f55021e37bc) fix: test ### 📊 Changes **7 files changed** (+191 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/oidc-provider/authorize.ts` (+19 -7) ➕ `packages/better-auth/src/plugins/oidc-provider/error.ts` (+13 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+38 -4) ➕ `packages/better-auth/src/plugins/oidc-provider/middlewares/check-prompt.ts` (+18 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+4 -12) ➕ `packages/better-auth/src/plugins/oidc-provider/utils/prompt.test.ts` (+69 -0) ➕ `packages/better-auth/src/plugins/oidc-provider/utils/prompt.ts` (+30 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Fixes OIDC prompt=login handling to always reauthenticate, prevents redirect loops after login, and adds spec‑compliant prompt parsing. Adds safer cookie parsing and a more robust login redirect URL. - **Bug Fixes** - Force reauth when prompt=login or no session; set signed cookie and redirect to the login page. - After login, mark oidcLoginPromptHandled to continue authorization without another redirect. - Parse and validate prompt per OIDC (login/consent/select_account/none); reject invalid combos with InvalidRequest. - Safely parse oidc_login_prompt cookie and preserve query params when redirecting; handle empty query strings. <sup>Written for commit 8d7b28d3d510cf0621b000843d305f55021e37bc. 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-15 21:31:59 -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#23176