[PR #5816] chore: remove additionalData config for oauth config #14493

Closed
opened 2026-04-13 09:30:15 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5816

State: closed
Merged: Yes


Summary by cubic

Removed oauthConfig.additionalData and made custom fields part of the OAuth state by default. This simplifies setup, exposes extra data via getOAuthState during the OAuth callback, and prevents overriding core state fields.

  • Refactors

    • Dropped advanced.oauthConfig.additionalData and its schema validation.
    • OAuth state now includes default fields plus any custom keys; core fields cannot be overridden.
    • Renamed setOauthState to setOAuthState; exported getOAuthState unchanged.
    • generateState merges additionalData into state and stores it; parseState accepts loose fields.
    • defineRequestState now has a default permissive schema.
    • Updated docs, tests, and types accordingly.
  • Migration

    • Remove advanced.oauthConfig.additionalData from your config.
    • Replace setOauthState with setOAuthState.
    • Move any previous additionalData schema checks to your hooks (e.g., validate with zod).
    • Expect base OAuth state fields (callbackURL, codeVerifier, errorURL, newUserURL, link, requestSignUp, expiresAt) in getOAuthState results.

Written for commit 57f382c3ff. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5816 **State:** closed **Merged:** Yes --- <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Removed oauthConfig.additionalData and made custom fields part of the OAuth state by default. This simplifies setup, exposes extra data via getOAuthState during the OAuth callback, and prevents overriding core state fields. - **Refactors** - Dropped advanced.oauthConfig.additionalData and its schema validation. - OAuth state now includes default fields plus any custom keys; core fields cannot be overridden. - Renamed setOauthState to setOAuthState; exported getOAuthState unchanged. - generateState merges additionalData into state and stores it; parseState accepts loose fields. - defineRequestState now has a default permissive schema. - Updated docs, tests, and types accordingly. - **Migration** - Remove advanced.oauthConfig.additionalData from your config. - Replace setOauthState with setOAuthState. - Move any previous additionalData schema checks to your hooks (e.g., validate with zod). - Expect base OAuth state fields (callbackURL, codeVerifier, errorURL, newUserURL, link, requestSignUp, expiresAt) in getOAuthState results. <sup>Written for commit 57f382c3ff4d4444f5761e3b45127fb864b33107. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:30:15 -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#14493