[PR #6331] [CLOSED] fix(username): support callbackURL redirection in login response #6597

Closed
opened 2026-03-13 13:04:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6331
Author: @GautamBytes
Created: 11/26/2025
Status: Closed

Base: canaryHead: fix/username-callback-url


📝 Commits (2)

  • 3e30b86 fix(username): add callbackURL support to login response
  • f9ca25a sync OpenAPI schema

📊 Changes

2 files changed (+40 additions, -0 deletions)

View changed files

📝 packages/better-auth/src/plugins/username/index.ts (+10 -0)
📝 packages/better-auth/src/plugins/username/username.test.ts (+30 -0)

📄 Description

Description

Closes #6297

This PR fixes an issue where the username plugin would not redirect users to the specified callbackURL after a successful login. Unlike the emailAndPassword plugin, the username login endpoint was not returning the redirect and url properties in the JSON response, causing the client to remain on the current page.

Changes

  • Modified packages/better-auth/src/plugins/username/index.ts: Updated the signInUsername endpoint to include redirect and url in the returned JSON object.
  • Modified packages/better-auth/src/plugins/username/username.test.ts: Added a new test case to verify that callbackURL is correctly returned in the response payload.

Summary by cubic

Adds callbackURL support to the username login response so clients can redirect after sign-in. Matches email/password behavior and fixes users staying on the current page.

  • Bug Fixes
    • Return redirect (boolean) and url (callbackURL) from signIn.username.
    • Add tests and sync OpenAPI schema for these fields.

Written for commit f9ca25aa27. 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/6331 **Author:** [@GautamBytes](https://github.com/GautamBytes) **Created:** 11/26/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/username-callback-url` --- ### 📝 Commits (2) - [`3e30b86`](https://github.com/better-auth/better-auth/commit/3e30b86b9a95f4a510f174105860b289676cc65f) fix(username): add callbackURL support to login response - [`f9ca25a`](https://github.com/better-auth/better-auth/commit/f9ca25aa27b14535cddc7069c7f7dce30bfa058d) sync OpenAPI schema ### 📊 Changes **2 files changed** (+40 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/username/index.ts` (+10 -0) 📝 `packages/better-auth/src/plugins/username/username.test.ts` (+30 -0) </details> ### 📄 Description ## Description Closes #6297 This PR fixes an issue where the `username` plugin would not redirect users to the specified `callbackURL` after a successful login. Unlike the `emailAndPassword` plugin, the username login endpoint was not returning the `redirect` and `url` properties in the JSON response, causing the client to remain on the current page. ## Changes - Modified `packages/better-auth/src/plugins/username/index.ts`: Updated the `signInUsername` endpoint to include `redirect` and `url` in the returned JSON object. - Modified `packages/better-auth/src/plugins/username/username.test.ts`: Added a new test case to verify that `callbackURL` is correctly returned in the response payload. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Adds callbackURL support to the username login response so clients can redirect after sign-in. Matches email/password behavior and fixes users staying on the current page. - **Bug Fixes** - Return redirect (boolean) and url (callbackURL) from signIn.username. - Add tests and sync OpenAPI schema for these fields. <sup>Written for commit f9ca25aa27b14535cddc7069c7f7dce30bfa058d. 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-03-13 13:04:46 -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#6597