[PR #8286] [MERGED] fix(oauth-provider): allow localhost subdomains in isLocalhost function #16116

Closed
opened 2026-04-13 10:23:36 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8286
Author: @sicarius97
Created: 3/2/2026
Status: Merged
Merged: 3/2/2026
Merged by: @himself65

Base: canaryHead: oauth-islocalhost-fix


📝 Commits (4)

  • c890351 Allow localhost subdomains in isLocalhost function
  • 49eae4e Refactor isLocalhost function for readability
  • 7b95e89 Refactor isLocalhost function for readability
  • 4371c3f fix: lint

📊 Changes

1 file changed (+4 additions, -1 deletions)

View changed files

📝 packages/oauth-provider/src/types/zod.ts (+4 -1)

📄 Description

This would allow a user to set a subdomain.localhost as a redirect uri for oauth. Currently it will not allow localhost subdomains which are common in some companies development practices. This is a very simple 1 line logic change.


Summary by cubic

Treat *.localhost as localhost in OAuth redirect URI validation so subdomain.localhost redirects (e.g., app.localhost) work in local development. Refactors isLocalhost in oauth-provider zod types for clarity; fixes lint.

Written for commit 4371c3fc1e. 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/8286 **Author:** [@sicarius97](https://github.com/sicarius97) **Created:** 3/2/2026 **Status:** ✅ Merged **Merged:** 3/2/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `oauth-islocalhost-fix` --- ### 📝 Commits (4) - [`c890351`](https://github.com/better-auth/better-auth/commit/c890351029cda50216bc6bb4d7f77a051010b35a) Allow localhost subdomains in isLocalhost function - [`49eae4e`](https://github.com/better-auth/better-auth/commit/49eae4e8ab6e6ce8eddf6d67ef8352406b4e6bcc) Refactor isLocalhost function for readability - [`7b95e89`](https://github.com/better-auth/better-auth/commit/7b95e89e8295a21693dbfd552bca3705180462a5) Refactor isLocalhost function for readability - [`4371c3f`](https://github.com/better-auth/better-auth/commit/4371c3fc1e2dfc775ee38e423bf85683afe380d6) fix: lint ### 📊 Changes **1 file changed** (+4 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/oauth-provider/src/types/zod.ts` (+4 -1) </details> ### 📄 Description This would allow a user to set a subdomain.localhost as a redirect uri for oauth. Currently it will not allow localhost subdomains which are common in some companies development practices. This is a very simple 1 line logic change. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Treat *.localhost as localhost in OAuth redirect URI validation so subdomain.localhost redirects (e.g., app.localhost) work in local development. Refactors isLocalhost in oauth-provider zod types for clarity; fixes lint. <sup>Written for commit 4371c3fc1e2dfc775ee38e423bf85683afe380d6. 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-13 10:23:36 -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#16116