[PR #5638] feat: OAuth additional data #14378

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

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

State: closed
Merged: No


Summary by cubic

Adds support for passing validated additional data through OAuth sign-in and account linking, and applies it to user creation/updates. This enables clients to persist extra fields (e.g., locale, consent) across redirects.

  • New Features

    • Accepts data in sign-inSocial, linkSocialAccount, and generic OAuth authorize requests; persisted via OAuth state.
    • Validates with advanced.oauthConfig.additionalData.schema (Standard Schema). Invalid input redirects with invalid_additional_data.
    • Exposes validated data as c.context.oauthState and merges it into updateUser/createOAuthUser.
    • New config: advanced.oauthConfig.additionalData { enabled, schema } and types support.
  • Migration

    • Enable advanced.oauthConfig.additionalData.enabled and optionally provide a StandardSchemaV1 schema.
    • Send data from the client under data in sign-in/link requests; ensure it matches your schema.

Written for commit 6af7b9aede. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5638 **State:** closed **Merged:** No --- <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Adds support for passing validated additional data through OAuth sign-in and account linking, and applies it to user creation/updates. This enables clients to persist extra fields (e.g., locale, consent) across redirects. - New Features - Accepts data in sign-inSocial, linkSocialAccount, and generic OAuth authorize requests; persisted via OAuth state. - Validates with advanced.oauthConfig.additionalData.schema (Standard Schema). Invalid input redirects with invalid_additional_data. - Exposes validated data as c.context.oauthState and merges it into updateUser/createOAuthUser. - New config: advanced.oauthConfig.additionalData { enabled, schema } and types support. - Migration - Enable advanced.oauthConfig.additionalData.enabled and optionally provide a StandardSchemaV1 schema. - Send data from the client under data in sign-in/link requests; ensure it matches your schema. <sup>Written for commit 6af7b9aede4ae1c5bbe5c60f52791884f5edd866. 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:26:45 -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#14378