[PR #6837] [CLOSED] fix(oidc): add support for public clients with no client secret #23814

Closed
opened 2026-04-15 21:59:54 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/6837
Author: @marcoskichel
Created: 12/17/2025
Status: Closed

Base: canaryHead: kichelm/fix-public-clients-secret-id-usage


📝 Commits (1)

  • 2a13352 fix(oidc): handle public client ID token signing and verification value deletion

📊 Changes

2 files changed (+250 additions, -21 deletions)

View changed files

📝 packages/better-auth/src/plugins/oidc-provider/index.ts (+34 -21)
📝 packages/better-auth/src/plugins/oidc-provider/oidc.test.ts (+216 -0)

📄 Description

Summary

Fixes a few related bugs in the OIDC provider that prevented public OAuth clients (like ChatGPT) from authenticating using PKCE without client secrets.

Problem

The OIDC provider had several issues:

  1. Public client ID token signing failure: Attempted to sign ID tokens with undefined clientSecret for public clients, causing crashes
  2. Foreign key constraint for trusted clients: Attempted to create database records for trusted clients that don't exist in the database

Solution

  1. Fixed ID token signing: Use server secret for public clients when clientSecret is unavailable
  2. Fixed trusted clients: Skip database record creation for trusted clients that are configured in memory

Summary by cubic

Fixes OIDC to fully support public OAuth clients using PKCE. Authorization codes are invalidated on first use, public client ID tokens use the server secret when no client secret is present, and access tokens aren’t stored for trusted clients.

  • Bug Fixes
    • Delete verification value immediately to invalidate the code after any use attempt.
    • Sign public client ID tokens with the server secret when clientSecret is missing.
    • Skip access token DB records for trusted clients to avoid foreign key issues.

Written for commit 2a133526bd. 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/6837 **Author:** [@marcoskichel](https://github.com/marcoskichel) **Created:** 12/17/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `kichelm/fix-public-clients-secret-id-usage` --- ### 📝 Commits (1) - [`2a13352`](https://github.com/better-auth/better-auth/commit/2a133526bdbf36c1339b76107cc1db83cbf82a40) fix(oidc): handle public client ID token signing and verification value deletion ### 📊 Changes **2 files changed** (+250 additions, -21 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/oidc-provider/index.ts` (+34 -21) 📝 `packages/better-auth/src/plugins/oidc-provider/oidc.test.ts` (+216 -0) </details> ### 📄 Description ## Summary Fixes a few related bugs in the OIDC provider that prevented public OAuth clients (like ChatGPT) from authenticating using PKCE without client secrets. ## Problem The OIDC provider had several issues: 1. **Public client ID token signing failure**: Attempted to sign ID tokens with undefined `clientSecret` for public clients, causing crashes 2. **Foreign key constraint for trusted clients**: Attempted to create database records for trusted clients that don't exist in the database ## Solution 1. **Fixed ID token signing**: Use server secret for public clients when `clientSecret` is unavailable 2. **Fixed trusted clients**: Skip database record creation for trusted clients that are configured in memory <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes OIDC to fully support public OAuth clients using PKCE. Authorization codes are invalidated on first use, public client ID tokens use the server secret when no client secret is present, and access tokens aren’t stored for trusted clients. - **Bug Fixes** - Delete verification value immediately to invalidate the code after any use attempt. - Sign public client ID tokens with the server secret when clientSecret is missing. - Skip access token DB records for trusted clients to avoid foreign key issues. <sup>Written for commit 2a133526bdbf36c1339b76107cc1db83cbf82a40. 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-04-15 21:59:54 -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#23814