[GH-ISSUE #2876] OIDC Provider trusted flow #9379

Closed
opened 2026-04-13 04:49:20 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @BadPirate on GitHub (Jun 2, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2876

Problem

The current OIDC provider implementation requires all clients to be registered dynamically via the /oauth2/register endpoint or stored in the database. This creates several challenges for first-party applications and internal services:

  • Cumbersome registration flow: Internal/trusted applications need to go through the same registration process as third-party clients
  • Database dependency: All client lookups require database queries, adding latency for high-frequency operations
  • Consent screen friction: Trusted first-party applications typically shouldn't require user consent, but this capability is mentioned in documentation but not implemented
    Deployment complexity: Critical clients can't be configured directly in code/environment variables

Use Cases

  • Internal dashboards and admin panels
  • First-party mobile applications
  • Microservice-to-microservice authentication
  • Development and testing environments
  • Any scenario where the client is fully trusted and consent is unnecessary

Proposed Solution

  • Add support for trustedClients configuration in the OIDC provider options that allows:
  • Hard-coded client configuration: Define clients directly in the provider configuration
  • Optional consent bypass: Trusted clients can skip consent screens via skipConsent flag
  • Performance optimization: Trusted clients bypass database lookups
  • Backward compatibility: Existing database-registered clients continue to work unchanged
Originally created by @BadPirate on GitHub (Jun 2, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2876 # Problem The current OIDC provider implementation requires all clients to be registered dynamically via the /oauth2/register endpoint or stored in the database. This creates several challenges for first-party applications and internal services: - Cumbersome registration flow: Internal/trusted applications need to go through the same registration process as third-party clients - Database dependency: All client lookups require database queries, adding latency for high-frequency operations - Consent screen friction: Trusted first-party applications typically shouldn't require user consent, but this capability is mentioned in documentation but not implemented Deployment complexity: Critical clients can't be configured directly in code/environment variables ## Use Cases - Internal dashboards and admin panels - First-party mobile applications - Microservice-to-microservice authentication - Development and testing environments - Any scenario where the client is fully trusted and consent is unnecessary # Proposed Solution - Add support for trustedClients configuration in the OIDC provider options that allows: - Hard-coded client configuration: Define clients directly in the provider configuration - Optional consent bypass: Trusted clients can skip consent screens via skipConsent flag - Performance optimization: Trusted clients bypass database lookups - Backward compatibility: Existing database-registered clients continue to work unchanged
GiteaMirror added the locked label 2026-04-13 04:49:20 -05:00
Author
Owner

@BadPirate commented on GitHub (Jun 2, 2025):

Working on this feature for myself, will submit a PR once tested.

<!-- gh-comment-id:2931669125 --> @BadPirate commented on GitHub (Jun 2, 2025): Working on this feature for myself, will submit a PR once tested.
Author
Owner

@gautamsi commented on GitHub (Jul 20, 2025):

Do you plan to add adminConsent flag? I see that for first party app and trusted apps, there is need to add static configuration of apps. If you look at Google or MS Entra, there is an option to provide admin consent to the app created by admins, this way no one is needed to consent and seems first party apps.

<!-- gh-comment-id:3094730167 --> @gautamsi commented on GitHub (Jul 20, 2025): Do you plan to add adminConsent flag? I see that for first party app and trusted apps, there is need to add static configuration of apps. If you look at Google or MS Entra, there is an option to provide admin consent to the app created by admins, this way no one is needed to consent and seems first party apps.
Author
Owner

@Stradi commented on GitHub (Jul 21, 2025):

Trusted Clients feature requires deleting foreign key constraint from oauthAccessToken table for clientId column. Maybe this could be added to the docs.

Actually better-auth doesn't care about this foreign key, but docs are still wrong about it.

For reference: https://www.better-auth.com/docs/plugins/oidc-provider#oauth-access-token

<!-- gh-comment-id:3095560783 --> @Stradi commented on GitHub (Jul 21, 2025): Trusted Clients feature requires deleting foreign key constraint from `oauthAccessToken` table for `clientId` column. Maybe this could be added to the docs. Actually `better-auth` doesn't care about this foreign key, but docs are still wrong about it. For reference: https://www.better-auth.com/docs/plugins/oidc-provider#oauth-access-token
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#9379