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

Closed
opened 2026-03-13 12:52:13 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5813
Author: @himself65
Created: 11/6/2025
Status: Merged
Merged: 11/7/2025
Merged by: @himself65

Base: canaryHead: himself65/2025/11/06/oauth


📝 Commits (3)

📊 Changes

6 files changed (+107 additions, -83 deletions)

View changed files

📝 packages/better-auth/src/plugins/mcp/authorize.ts (+2 -1)
📝 packages/better-auth/src/plugins/oidc-provider/authorize.ts (+0 -1)
📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+29 -28)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+13 -4)
📝 packages/better-auth/src/plugins/oidc-provider/schema.ts (+56 -0)
📝 packages/better-auth/src/plugins/oidc-provider/types.ts (+7 -49)

📄 Description

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.


🔄 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/5813 **Author:** [@himself65](https://github.com/himself65) **Created:** 11/6/2025 **Status:** ✅ Merged **Merged:** 11/7/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `himself65/2025/11/06/oauth` --- ### 📝 Commits (3) - [`e6d8c7b`](https://github.com/better-auth/better-auth/commit/e6d8c7bd005ad1578fa2d6b031ac5a1aeaebbc81) fix(oauth): improve typing - [`cd8ed26`](https://github.com/better-auth/better-auth/commit/cd8ed26e64d27a883322c3c7cc7a36d564a1d30f) fix: omit - [`a5378e2`](https://github.com/better-auth/better-auth/commit/a5378e22b927f63d4bea5bb41640a0a40d5a2307) test: fix ### 📊 Changes **6 files changed** (+107 additions, -83 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/mcp/authorize.ts` (+2 -1) 📝 `packages/better-auth/src/plugins/oidc-provider/authorize.ts` (+0 -1) 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+29 -28) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+13 -4) 📝 `packages/better-auth/src/plugins/oidc-provider/schema.ts` (+56 -0) 📝 `packages/better-auth/src/plugins/oidc-provider/types.ts` (+7 -49) </details> ### 📄 Description <!-- 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. --> --- <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 12:52:13 -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#6244