[PR #2640] [MERGED] Use custom errorURL when available #4418

Closed
opened 2026-03-13 11:45:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2640
Author: @ErikPetersenDev
Created: 5/13/2025
Status: Merged
Merged: 6/15/2025
Merged by: @Bekacru

Base: mainHead: respect-custom-error-url


📝 Commits (3)

📊 Changes

4 files changed (+55 additions, -32 deletions)

View changed files

📝 packages/better-auth/src/oauth2/link-account.ts (+3 -3)
📝 packages/better-auth/src/oauth2/state.ts (+6 -6)
📝 packages/better-auth/src/plugins/oidc-provider/authorize.ts (+42 -20)
📝 packages/better-auth/src/plugins/sso/index.ts (+4 -3)

📄 Description

This PR resolves: https://github.com/better-auth/better-auth/issues/2519

Summary

There are a few places in the code where the custom errorURL is not checked/used, resulting in the default Better Auth error page. This PR copies the way this is done elsewhere to check for the custom errorURL in context before deciding which URL to use.

Notes

Future improvement opportunities: centralize the logic so it isn't duplicated throughout the codebase as it is today. Or potentially have a higher level error function that handles throwing the redirect with the error URL. I kept it simple for this bug fix though.


🔄 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/2640 **Author:** [@ErikPetersenDev](https://github.com/ErikPetersenDev) **Created:** 5/13/2025 **Status:** ✅ Merged **Merged:** 6/15/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `respect-custom-error-url` --- ### 📝 Commits (3) - [`cccbec2`](https://github.com/better-auth/better-auth/commit/cccbec24d5abffe37c97d9044029d66ba45e8967) Use custom errorURL when available - [`a6b43e7`](https://github.com/better-auth/better-auth/commit/a6b43e75a250d3a3d9ba5a3bf43f0814b78d5751) merge main - [`a2f1920`](https://github.com/better-auth/better-auth/commit/a2f19200290d934b9e6a39d663f307a5c5ca21b4) fix oidc ### 📊 Changes **4 files changed** (+55 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/oauth2/link-account.ts` (+3 -3) 📝 `packages/better-auth/src/oauth2/state.ts` (+6 -6) 📝 `packages/better-auth/src/plugins/oidc-provider/authorize.ts` (+42 -20) 📝 `packages/better-auth/src/plugins/sso/index.ts` (+4 -3) </details> ### 📄 Description This PR resolves: https://github.com/better-auth/better-auth/issues/2519 ### Summary There are a few places in the code where the custom errorURL is not checked/used, resulting in the default Better Auth error page. This PR copies the way this is done elsewhere to check for the custom errorURL in context before deciding which URL to use. ### Notes Future improvement opportunities: centralize the logic so it isn't duplicated throughout the codebase as it is today. Or potentially have a higher level error function that handles throwing the redirect with the error URL. I kept it simple for this bug fix though. --- <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 11:45:35 -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#4418