[PR #5420] [MERGED] fix: user-agent requirement when fetching from clients #5995

Closed
opened 2026-03-13 12:44:05 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5420
Author: @dvanmali
Created: 10/20/2025
Status: Merged
Merged: 10/20/2025
Merged by: @himself65

Base: canaryHead: headersFix


📝 Commits (1)

  • 5d2b281 fix: user-agent requirement on client endpoint

📊 Changes

3 files changed (+12 additions, -3 deletions)

View changed files

📝 packages/better-auth/src/client/config.ts (+2 -1)
📝 packages/better-auth/src/client/fetch-plugins.ts (+10 -0)
📝 packages/core/src/oauth2/validate-authorization-code.ts (+0 -2)

📄 Description

Client request fails early without user-agent: better-auth header resulting in ERROR [Better Auth]: Invalid request.

Fixes failing tests on #4163.


Summary by cubic

Added user-agent: better-auth to OAuth client credentials and refresh token requests so the server accepts them and we avoid "Invalid request" errors. Fixes failing tests in #4163.


🔄 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/5420 **Author:** [@dvanmali](https://github.com/dvanmali) **Created:** 10/20/2025 **Status:** ✅ Merged **Merged:** 10/20/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `headersFix` --- ### 📝 Commits (1) - [`5d2b281`](https://github.com/better-auth/better-auth/commit/5d2b28190334d6fe4d83ecbc75fa31b0f47d8274) fix: user-agent requirement on client endpoint ### 📊 Changes **3 files changed** (+12 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/client/config.ts` (+2 -1) 📝 `packages/better-auth/src/client/fetch-plugins.ts` (+10 -0) 📝 `packages/core/src/oauth2/validate-authorization-code.ts` (+0 -2) </details> ### 📄 Description Client request fails early without `user-agent: better-auth` header resulting in `ERROR [Better Auth]: Invalid request`. Fixes failing tests on #4163. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Added user-agent: better-auth to OAuth client credentials and refresh token requests so the server accepts them and we avoid "Invalid request" errors. Fixes failing tests in #4163. <!-- 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 12:44: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#5995