WIP: Multi-Tenant OpenID Authentication Support #5732
Draft
+374
−58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🎯 Summary
Closes: #4544
This PR introduces support for multi-tenant OpenID authentication. Instead of relying on a single OpenID configuration, the system can now handle multiple tenants, each with its own client ID, client secret, and issuer. The PR also includes UI updates to accommodate multi-tenant login, backend logic refactoring, and YAML configuration updates.
🔍 Changes Overview
🔧 Configuration Updates
.env.example
OPENID_CLIENT_ID
,OPENID_CLIENT_SECRET
, andOPENID_ISSUER
withOPENID_ENABLED
.OPENID_MULTI_TENANT
support.librechat.example.yaml
openid.tenants
array for defining multiple OpenID providers.⚙️ Backend Enhancements
api/server/routes/config.js
OPENID_ENABLED
instead of requiring all individual OpenID env variables.openidMultiTenantEnabled
flag.api/server/routes/oauth.js
chooseOpenIdStrategy
.api/server/utils/openidHelper.js
(New file!)api/strategies/openidStrategy.js
🖥️ UI & Frontend Updates
client/src/components/Auth/MultiTenantOpenID.tsx
(New file!)client/src/components/Auth/SocialLoginRender.tsx
openidMultiTenantEnabled
is true.packages/data-provider/src/config.ts
TStartupConfig
schema to includeopenidMultiTenantEnabled
.Single-tenant
Multi-tenant
✅ TODO
🧪 Testing
Test Configuration:
OPENID_MULTI_TENANT=true
.librechat.example.yaml
.📋 Checklist