[PR #5813] fix(oidc-provider): improve typing #14491

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

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

State: closed
Merged: Yes


Summary by cubic

Strengthened OAuth/OIDC typing by introducing a Zod-backed OAuthApplication schema and refactoring getClient to use the auth context adapter. Client data is now strictly typed, normalized, and DB-only fields are not exposed.

  • Refactors

    • Added oAuthApplicationSchema and OAuthApplication type (Zod).
    • Derived Client from OAuthApplication; parse metadata to an object and split redirectUrls into an array.
    • Updated findOne calls to use typed ; getClient now reads adapter from getCurrentAuthContext and no longer accepts an adapter param.
    • getClient returns a minimal, safe client object and omits unused DB fields.
  • Tests

    • Updated OIDC tests to reflect optional fields (icon can be null).
    • Removed assumptions of empty string defaults and validated getOAuthClient response shape.

Written for commit a5378e22b9. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5813 **State:** closed **Merged:** Yes --- <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Strengthened OAuth/OIDC typing by introducing a Zod-backed OAuthApplication schema and refactoring getClient to use the auth context adapter. Client data is now strictly typed, normalized, and DB-only fields are not exposed. - **Refactors** - Added oAuthApplicationSchema and OAuthApplication type (Zod). - Derived Client from OAuthApplication; parse metadata to an object and split redirectUrls into an array. - Updated findOne calls to use typed <OAuthApplication>; getClient now reads adapter from getCurrentAuthContext and no longer accepts an adapter param. - getClient returns a minimal, safe client object and omits unused DB fields. - **Tests** - Updated OIDC tests to reflect optional fields (icon can be null). - Removed assumptions of empty string defaults and validated getOAuthClient response shape. <sup>Written for commit a5378e22b927f63d4bea5bb41640a0a40d5a2307. 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:11 -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#14491