[PR #8019] [MERGED] test(oauth-provider): add regression for pre-parsed form-urlencoded token body #24591

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8019
Author: @bytaesu
Created: 2/17/2026
Status: Merged
Merged: 3/6/2026
Merged by: @bytaesu

Base: canaryHead: 2026-02-17/test/oauth-token-form-urlencoded-regression


📝 Commits (5)

  • 3be4511 test(oauth-provider): add regression for pre-parsed form-urlencoded token body
  • 0c23a5b test: no async describe
  • 50808c4 fix: lockfile
  • bd0b41f fix: drop pnpm-lock diff
  • 3b0e9a3 Merge branch 'canary' into 2026-02-17/test/oauth-token-form-urlencoded-regression

📊 Changes

1 file changed (+89 additions, -3 deletions)

View changed files

📝 packages/oauth-provider/src/oauth.test.ts (+89 -3)

📄 Description

Note

This test case will pass after merging https://github.com/better-auth/better-call/pull/108 and updating the better-call version


Summary by cubic

Add a regression test to ensure application/x-www-form-urlencoded token bodies are preserved when req.body is pre-parsed, preventing broken client_credentials token exchange. Closes better-auth/better-auth#8017 and aligns with the upcoming fix in better-call.

  • Bug Fixes

    • Add test for /api/auth/oauth2/token to verify token body is not lost when middleware pre-parses req.body.
    • Move async setup into beforeAll to avoid async describe.
    • Use a temporary server to pick an open port and avoid conflicts during tests.
  • Dependencies

    • Mark some packages as optional in pnpm-lock.yaml to stabilize installs.

Written for commit cd1655c37e. 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/8019 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 2/17/2026 **Status:** ✅ Merged **Merged:** 3/6/2026 **Merged by:** [@bytaesu](https://github.com/bytaesu) **Base:** `canary` ← **Head:** `2026-02-17/test/oauth-token-form-urlencoded-regression` --- ### 📝 Commits (5) - [`3be4511`](https://github.com/better-auth/better-auth/commit/3be45110dad31d55214b9920cf82504ca84ad211) test(oauth-provider): add regression for pre-parsed form-urlencoded token body - [`0c23a5b`](https://github.com/better-auth/better-auth/commit/0c23a5b655f1f4bfe0a84a8651790f3743b04fa5) test: no async describe - [`50808c4`](https://github.com/better-auth/better-auth/commit/50808c4646e76ab3ac44d47961592262c58f912d) fix: lockfile - [`bd0b41f`](https://github.com/better-auth/better-auth/commit/bd0b41fded09ef27b0385bae856f2a494ab9b8ed) fix: drop pnpm-lock diff - [`3b0e9a3`](https://github.com/better-auth/better-auth/commit/3b0e9a391acf618eec603cc6c14cdeec8b29033d) Merge branch 'canary' into 2026-02-17/test/oauth-token-form-urlencoded-regression ### 📊 Changes **1 file changed** (+89 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/oauth-provider/src/oauth.test.ts` (+89 -3) </details> ### 📄 Description > [!NOTE] > This test case will pass after merging https://github.com/better-auth/better-call/pull/108 and updating the `better-call` version - Closes https://github.com/better-auth/better-auth/issues/8017 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Add a regression test to ensure application/x-www-form-urlencoded token bodies are preserved when req.body is pre-parsed, preventing broken client_credentials token exchange. Closes better-auth/better-auth#8017 and aligns with the upcoming fix in better-call. - **Bug Fixes** - Add test for /api/auth/oauth2/token to verify token body is not lost when middleware pre-parses req.body. - Move async setup into beforeAll to avoid async describe. - Use a temporary server to pick an open port and avoid conflicts during tests. - **Dependencies** - Mark some packages as optional in pnpm-lock.yaml to stabilize installs. <sup>Written for commit cd1655c37ec017dfd594ed67de1d6fe51886034b. 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-04-15 22:27:08 -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#24591