[PR #8693] [MERGED] feat(sso): Add logging for when code validation fails in oidc callback #25050

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8693
Author: @OscarCornish
Created: 3/19/2026
Status: Merged
Merged: 3/19/2026
Merged by: @himself65

Base: canaryHead: feat/sso-oidc-callback-code-validation-logging


📝 Commits (1)

  • f2645d1 feat(sso): Add logging for when code validation fails in oidc callback

📊 Changes

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

View changed files

📝 packages/sso/src/routes/sso.ts (+1 -0)

📄 Description

When code exchange fails, the error object is thrown:

b1be9cf61b/packages/core/src/oauth2/validate-authorization-code.ts (L154-L161)

But further up the call stack this gets swallowed:

b1be9cf61b/packages/sso/src/routes/sso.ts (L1603-L1612)

This is not a BetterFetchError, so this redirect is missed and a generic error replaces it.

The generic error is fine, but it'd be really great to see what is happening here, as OIDC provider errors are lost otherwise.


🔄 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/8693 **Author:** [@OscarCornish](https://github.com/OscarCornish) **Created:** 3/19/2026 **Status:** ✅ Merged **Merged:** 3/19/2026 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `feat/sso-oidc-callback-code-validation-logging` --- ### 📝 Commits (1) - [`f2645d1`](https://github.com/better-auth/better-auth/commit/f2645d1ff924f54d3c790f5ba5cd8e58b006fa45) feat(sso): Add logging for when code validation fails in oidc callback ### 📊 Changes **1 file changed** (+1 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/sso/src/routes/sso.ts` (+1 -0) </details> ### 📄 Description When code exchange fails, the error object is thrown: https://github.com/better-auth/better-auth/blob/b1be9cf61b1e6a61bcab476397b0d5eaff0785f0/packages/core/src/oauth2/validate-authorization-code.ts#L154-L161 But further up the call stack this gets swallowed: https://github.com/better-auth/better-auth/blob/b1be9cf61b1e6a61bcab476397b0d5eaff0785f0/packages/sso/src/routes/sso.ts#L1603-L1612 This is not a `BetterFetchError`, so this redirect is missed and a generic error replaces it. The generic error is fine, but it'd be really great to see what is happening here, as OIDC provider errors are lost otherwise. --- <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:42:22 -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#25050