Skip to main content

OpenID Connect (OIDC)

Set QUI__OIDC_ENABLED=true to delegate authentication to an external identity provider. You must also set the issuer, client ID, client secret, and redirect URL. If one of these values is missing, or qui cannot reach the issuer, qui does not start. When OIDC is enabled, the login screen shows an OpenID Connect button.

If your provider advertises PKCE (S256) support, qui uses it for the authorization flow. You do not need to configure extra settings in qui. To make sure that PKCE is active, inspect /api/auth/oidc/config. The authorizationUrl must include both code_challenge= and code_challenge_method=S256. qui does not emit a dedicated "PKCE enabled" log line, so check the authorization URL directly.

By default, qui accepts every identity that the provider permits for the qui client. To let only your own account log in, set one of these two keys:

  • oidcAllowedSubject (QUI__OIDC_ALLOWED_SUBJECT): Only the account with this subject identifier (sub) can log in. The match is exact and includes letter case.
  • oidcAllowedEmail (QUI__OIDC_ALLOWED_EMAIL): Only an account with this email can log in. The match ignores letter case. qui accepts the email only when the provider marks it as verified.

Do not set both keys. If you set both, qui does not start. The subject identifier is unique in the provider. If your provider lets two accounts have the same email, both accounts can log in with oidcAllowedEmail. If you set neither key, qui logs a warning at startup.

To find your subject identifier, set oidcAllowedSubject to any value and log in. qui refuses the login and writes the sub of your account to the log.

qui reads a change to these keys when you save config.toml. You do not have to restart qui. If an open OIDC session no longer matches, it ends at its next request, and the browser goes to the login page. Password sessions and API keys do not change.

If you set oidcDisableBuiltInLogin and one of these keys has a wrong value, the login page gives you no way to log in. Correct the value in config.toml, and qui applies it without a restart.

An https:// redirect URL marks the session cookie as Secure, so the browser sends it only over HTTPS. See Sessions.

For the full mapping (TOML keys + environment variables + defaults), see Configuration Reference.

Configuration options​

VariableDescription
QUI__OIDC_ISSUERIssuer URL from your IdP (for example https://auth.example.com/realms/main)
QUI__OIDC_CLIENT_IDClient ID registered for qui
QUI__OIDC_CLIENT_SECRETClient secret generated by the provider
QUI__OIDC_CLIENT_SECRET_FILEPath to a file that contains the client secret. This setting overrides QUI__OIDC_CLIENT_SECRET
QUI__OIDC_REDIRECT_URLMust match the redirect URI allowed by the provider
QUI__OIDC_DISABLE_BUILT_IN_LOGINWhen OIDC is enabled, set to true to hide the local username/password form
QUI__OIDC_ALLOWED_SUBJECTOnly the account with this subject identifier (sub) can log in
QUI__OIDC_ALLOWED_EMAILOnly an account with this verified email can log in

Redirect URL format​

If you use a default install, use:

http://localhost:7476/api/auth/oidc/callback

If you use a reverse proxy, include your base URL:

https://host/qui/api/auth/oidc/callback

If you run OIDC behind an SSO proxy (for example Cloudflare Access or Pangolin), read SSO proxies and CORS for browser fetch behavior and proxy-side configuration.

Example configuration​

QUI__OIDC_ENABLED=true \
QUI__OIDC_ISSUER=https://auth.example.com/realms/main \
QUI__OIDC_CLIENT_ID=qui \
QUI__OIDC_CLIENT_SECRET=super-secret-value \
QUI__OIDC_REDIRECT_URL=https://qui.example.com/api/auth/oidc/callback \
QUI__OIDC_DISABLE_BUILT_IN_LOGIN=true \
qui serve

You can set the same options in config.toml with the oidc* keys that qui generate-config writes.