[PR #8320] fix(oauth-provider): improve allowed paths for oauth_query for client plugin #7897

Open
opened 2026-03-13 13:52:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8320
Author: @dvanmali
Created: 3/3/2026
Status: 🔄 Open

Base: canaryHead: opClientPaths


📝 Commits (3)

  • 34827c5 fix: open oauth_query to more endpoints
  • 9404e0b feat: post login test only
  • 0006cc3 fix: claude suggestion

📊 Changes

2 files changed (+90 additions, -28 deletions)

View changed files

📝 packages/oauth-provider/src/client.ts (+4 -14)
📝 packages/oauth-provider/src/oauth.test.ts (+86 -14)

📄 Description

Better design for oauth_query by removing client pathname requirement. Adds test to separate postLogin via /continue scenarios from organization setting example.

Breaking: Cookie setting on other endpoints cause authorize flow earlier (intentional) preventing the need to request from the continue endpoint.

Discussion: Discord
Linking: #7558
Replaces: #7960


Summary by cubic

Opens oauth_query to more client endpoints by removing the pathname check and injecting from window.location.search for non-GET/DELETE requests. This triggers earlier authorize redirects when cookies are set and adds tests for post-login via /continue and direct consent after selecting an organization.

  • Bug Fixes

    • Injects oauth_query when a query string exists and the method is not GET/DELETE, guarded by window checks to avoid SSR issues.
    • Added tests for post-login continue and organization selection, capturing Location redirects to validate consent and code issuance.
  • Migration

    • Flows that previously called /oauth2/continue after setting cookies or selecting an organization may now redirect earlier; remove unnecessary continue calls in those cases.

Written for commit 0006cc31d9. Summary will update 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/8320 **Author:** [@dvanmali](https://github.com/dvanmali) **Created:** 3/3/2026 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `opClientPaths` --- ### 📝 Commits (3) - [`34827c5`](https://github.com/better-auth/better-auth/commit/34827c594cb31b77e9439aa9b9a74b91a6e88513) fix: open oauth_query to more endpoints - [`9404e0b`](https://github.com/better-auth/better-auth/commit/9404e0b53583988a125d586aafec303a98204d2b) feat: post login test only - [`0006cc3`](https://github.com/better-auth/better-auth/commit/0006cc31d959cbc3dae0912266151839c849c9d1) fix: claude suggestion ### 📊 Changes **2 files changed** (+90 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `packages/oauth-provider/src/client.ts` (+4 -14) 📝 `packages/oauth-provider/src/oauth.test.ts` (+86 -14) </details> ### 📄 Description Better design for `oauth_query` by removing client pathname requirement. Adds test to separate `postLogin` via `/continue` scenarios from `organization` setting example. _Breaking_: Cookie setting on other endpoints cause authorize flow earlier (intentional) preventing the need to request from the `continue` endpoint. Discussion: [Discord](https://discord.com/channels/1288403910284935179/1470905432573743105) Linking: #7558 Replaces: #7960 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Opens oauth_query to more client endpoints by removing the pathname check and injecting from window.location.search for non-GET/DELETE requests. This triggers earlier authorize redirects when cookies are set and adds tests for post-login via /continue and direct consent after selecting an organization. - **Bug Fixes** - Injects oauth_query when a query string exists and the method is not GET/DELETE, guarded by window checks to avoid SSR issues. - Added tests for post-login continue and organization selection, capturing Location redirects to validate consent and code issuance. - **Migration** - Flows that previously called /oauth2/continue after setting cookies or selecting an organization may now redirect earlier; remove unnecessary continue calls in those cases. <sup>Written for commit 0006cc31d959cbc3dae0912266151839c849c9d1. Summary will update 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-03-13 13:52:34 -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#7897