Skip to content

feat: add ADMIN_SSO_ENABLED to hide SSO login button#71

Merged
danny-avila merged 1 commit into
mainfrom
feat/admin-sso-toggle
Jun 5, 2026
Merged

feat: add ADMIN_SSO_ENABLED to hide SSO login button#71
danny-avila merged 1 commit into
mainfrom
feat/admin-sso-toggle

Conversation

@danny-avila

Copy link
Copy Markdown
Contributor

Summary

Closes #61.

Adds an optional ADMIN_SSO_ENABLED env var (defaults to enabled). Set ADMIN_SSO_ENABLED=false to hide the admin-panel SSO button — and the SSO auto-redirect — while keeping email/password login, even when LibreChat has OpenID configured.

This addresses the confusing case described in the issue: when ADMIN_PANEL_URL isn't configured on the LibreChat server (or redirect URIs aren't registered with the OIDC provider), the SSO button shows up and returns "unauthorized". Admins can now suppress it and use local login for the admin panel while SSO stays configured for the main LibreChat app.

Implementation

  • src/server/auth.tscheckOpenIdFn short-circuits to { available: false, ssoOnly: false } when ADMIN_SSO_ENABLED=false, before calling the backend OpenID check (no wasted request). Because the SSO button only renders when available is true and auto-redirect only fires when ssoOnly is true, the existing login UI hides both with no component changes:
    • src/routes/login.tsx computes ssoOnly: openIdStatus.available && …false.
    • src/components/AuthCard.tsx renders the SSO button inside {ssoAvailable && (…)}.
  • Takes precedence over ADMIN_SSO_ONLY (disabling SSO can't coexist with "SSO only").

Docs

  • .env.example and README.md document the new variable (default true).

Tests

  • src/server/auth.oauth.test.ts — 5 new checkOpenIdFn unit tests: default availability, ADMIN_SSO_ONLY=true, the hide flag (and that it skips the backend call), precedence over ADMIN_SSO_ONLY, and backend-failure fallback.
  • Full suite green: npx vitest run → 575 passing.

Notes

tsc currently reports two pre-existing errors in RolePermissionsPanel.tsx / constants/role.ts (PermissionTypes.SKILLS, a data-provider version mismatch tied to #53) — in files this PR does not touch.

Adds an opt-out env var so deployments can hide the admin-panel SSO
button (and SSO auto-redirect) while keeping email/password login,
even when LibreChat has OpenID configured.

checkOpenIdFn short-circuits to { available: false, ssoOnly: false }
when ADMIN_SSO_ENABLED=false, before calling the backend OpenID check.
Because the SSO button only renders when available is true, the
existing login UI hides it with no component changes. Takes precedence
over ADMIN_SSO_ONLY.

Documents the var in .env.example and README, and adds checkOpenIdFn
unit tests covering default availability, ADMIN_SSO_ONLY, the hide flag,
precedence, and backend-failure fallback.

Closes #61
@danny-avila

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danny-avila danny-avila merged commit 1ba7d47 into main Jun 5, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option to hide SSO login button on admin panel

2 participants