Once more than a few people use your Open WebUI, separate passwords become a chore. Single sign-on (SSO) lets everyone log in with the Google, Microsoft or company account they already have, and lets you control who gets in, who is an admin and which groups they belong to from your identity provider.
Open WebUI supports three routes: built-in Google, Microsoft and GitHub sign-in, any OpenID Connect (OIDC) provider such as Okta, Keycloak, Authentik or Authelia, and trusted-header authentication behind a proxy.
All of them are set with environment variables, and most failed setups come down to the same few mistakes: a wrong redirect URI, sign-up left off, or settings stuck in the database.
This guide covers each provider step by step, the variables that matter, role and group mapping, and the fixes for the errors you are most likely to see. It follows the official Open WebUI documentation as of December 2026.
- Redirect URI:
https://your-domain/oauth/<provider>/callbackwhere provider isgoogle,microsoft,githuboroidc. - Always set:
WEBUI_URL, a fixedWEBUI_SECRET_KEYandENABLE_OAUTH_SIGNUP=truefor new users. - Google:
GOOGLE_CLIENT_ID+GOOGLE_CLIENT_SECRET. - Microsoft: client ID, secret and
MICROSOFT_CLIENT_TENANT_ID. Addoffline_accessto the scope. - Any OIDC:
OAUTH_CLIENT_ID,OAUTH_CLIENT_SECRET,OPENID_PROVIDER_URL(required). - Only one OIDC provider at a time. OAuth settings come from env vars by default and are read-only in the Admin Panel.
Choose Your SSO Method
| Method | Best for | Key variables |
|---|---|---|
| Google Workspace or Gmail users | GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET |
|
| Microsoft | Microsoft 365 / Entra ID organisations | MICROSOFT_CLIENT_ID, MICROSOFT_CLIENT_SECRET, MICROSOFT_CLIENT_TENANT_ID |
| GitHub | Developer teams | GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET |
| OIDC | Okta, Keycloak, Authentik, Authelia, Auth0 and others | OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OPENID_PROVIDER_URL |
| Trusted header | A proxy that already authenticates users (oauth2-proxy, Cloudflare Access, Tailscale Serve) | WEBUI_AUTH_TRUSTED_EMAIL_HEADER |
You can only configure one OIDC provider at a time through OPENID_PROVIDER_URL, so Microsoft and Google cannot both be OIDC providers. The docs link a community dual OAuth tutorial as a workaround.
Before You Start: The Core Variables
These apply to every OAuth provider:
| Variable | Default | Why it matters |
|---|---|---|
WEBUI_URL |
none | Your public address, such as https://chat.example.com. Used to send users back after the callback, and needed behind a proxy |
WEBUI_SECRET_KEY |
auto-generated | Must be fixed, and the same on every instance, or sessions and OAuth break |
ENABLE_OAUTH_SIGNUP |
false |
Lets SSO create accounts that do not exist yet. Separate from ENABLE_SIGNUP |
OAUTH_MERGE_ACCOUNTS_BY_EMAIL |
false |
Links SSO to an existing account with the same email, including admin accounts. Only for providers that verify emails |
ENABLE_OAUTH_PERSISTENT_CONFIG |
false |
Env vars stay in charge and the OAuth section of the Admin Panel is read-only |
DEFAULT_USER_ROLE |
pending |
New SSO users wait for approval unless you change this or map roles |
Two practical points. First, the redirect URI you register with the provider is exact. https:// versus http://, a trailing slash or a different hostname all break it.
Second, set up HTTPS first. Behind a reverse proxy you also want WEBUI_SESSION_COOKIE_SAME_SITE=lax and WEBUI_AUTH_COOKIE_SAME_SITE=lax, because strict can break OAuth callbacks. Our Open WebUI connection error guide covers reverse proxy settings.
Keep a local admin login working while you test, and back up first with our Open WebUI backup guide.
Set Up Google Sign-In
- Open Google Cloud Console and go to APIs and Services, then Credentials.
- Configure the OAuth consent screen if you have not already. Choose Internal for Workspace-only access.
- Create an OAuth client ID of type Web application.
- Add the redirect URI
https://chat.example.com/oauth/google/callback. - Copy the client ID and secret into your Open WebUI environment and restart.
WEBUI_URL=https://chat.example.com
GOOGLE_CLIENT_ID=1234567890-abc.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-google-secret
ENABLE_OAUTH_SIGNUP=true
OPENID_PROVIDER_URL is not needed for Google. To limit sign-in to your domain or force the account chooser, pass extra authorize parameters as JSON:
GOOGLE_OAUTH_AUTHORIZE_PARAMS={"prompt":"select_account","hd":"example.com"}
The hd hint shows only accounts from that domain on Google’s screen. For a hard restriction, use an Internal consent screen in Google Workspace.
Set Up Microsoft Entra ID Sign-In
- Open the Entra admin center and go to App registrations, then New registration.
- Choose the account type. Open WebUI supports a single tenant: one Entra organisation, or personal Microsoft accounts.
- Add a Web redirect URI:
https://chat.example.com/oauth/microsoft/callback. - Create a client secret under Certificates and secrets and copy its value.
- Copy the Application (client) ID and Directory (tenant) ID from the Overview page.
- Set the variables and restart.
WEBUI_URL=https://chat.example.com
MICROSOFT_CLIENT_ID=your-application-id
MICROSOFT_CLIENT_SECRET=your-secret-value
MICROSOFT_CLIENT_TENANT_ID=your-tenant-id
MICROSOFT_OAUTH_SCOPE=openid email profile offline_access
ENABLE_OAUTH_SIGNUP=true
For personal Microsoft accounts, the docs give the tenant ID 9188040d-6c67-4c5b-b112-36a304b66dad. MICROSOFT_REDIRECT_URI is optional. Leave it empty and Open WebUI uses /oauth/microsoft/callback on the incoming host.
Do not skip offline_access. Without it Microsoft returns no refresh token, and after about an hour you see No refresh token available for session in the logs.
Chat keeps working, but MCP tool servers using system OAuth, model connections set to OAuth, and OneDrive or SharePoint access fail. No extra Entra setup is needed for this scope.
Set Up GitHub Sign-In
- Open GitHub, then Settings, Developer settings, OAuth Apps, New OAuth App.
- Set the Homepage URL to your Open WebUI address.
- Set the Authorization callback URL to
https://chat.example.com/oauth/github/callback. - Generate a client secret and set both values.
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-secret
ENABLE_OAUTH_SIGNUP=true
Open WebUI needs an email address for every account, so if a GitHub sign-in fails, check the server log for the reason and confirm the person has a verified email on their GitHub account.
Set Up Any OIDC Provider (Okta, Keycloak, Authentik)
Any provider that speaks OpenID Connect works. The email claim is required, and name and picture are used when present.
- Create a client in your provider, type confidential or web app, with authorization code flow.
- Register the redirect URI exactly:
https://chat.example.com/oauth/oidc/callback. - Find the discovery URL, which ends in
/.well-known/openid-configuration. - Set the variables below and restart.
- Test in a private window. You should see a “Continue with” button using your provider name.
WEBUI_URL=https://chat.example.com
OAUTH_CLIENT_ID=open-webui
OAUTH_CLIENT_SECRET=your-client-secret
OPENID_PROVIDER_URL=https://auth.example.com/realms/main/.well-known/openid-configuration
OAUTH_PROVIDER_NAME=Company SSO
OAUTH_SCOPES=openid email profile
ENABLE_OAUTH_SIGNUP=true
| Variable | Notes |
|---|---|
OPENID_PROVIDER_URL |
Required for OIDC. The full well-known URL |
OAUTH_PROVIDER_NAME |
Button label, defaults to SSO |
OAUTH_SCOPES |
Defaults to openid email profile. Add groups if your provider needs it for group claims |
OAUTH_TOKEN_ENDPOINT_AUTH_METHOD |
client_secret_basic, client_secret_post or none when the provider accepts only one |
OPENID_REDIRECT_URI |
Optional override of the callback URL |
OAUTH_AUDIENCE |
Optional audience parameter, used by some providers such as Auth0 |
Common mistakes the docs call out: made-up variables such as OIDC_CONFIG or WEBUI_OIDC_CLIENT_ID, a missing OPENID_PROVIDER_URL, and a redirect URI that is not exactly /oauth/oidc/callback.
Map Roles and Groups From Your Provider
Roles: who is an admin
Set ENABLE_OAUTH_ROLE_MANAGEMENT=true and Open WebUI reads roles from the ID token and userinfo response at every login.
ENABLE_OAUTH_ROLE_MANAGEMENT=true
OAUTH_ROLES_CLAIM=roles
OAUTH_ALLOWED_ROLES=user,admin
OAUTH_ADMIN_ROLES=admin
OAUTH_ROLES_CLAIMcan be nested, such asuser.roles. If your provider has no roles claim, usegroups.- A user whose roles match neither list is refused. Use
*in allowed roles to let any role in. - Role changes apply at the next login. With Entra ID app roles, check that the values match these lists.
Groups: who sees which models and knowledge
Set ENABLE_OAUTH_GROUP_MANAGEMENT=true to sync Open WebUI groups from the groups claim at each login. Add ENABLE_OAUTH_GROUP_CREATION=true to create missing groups automatically.
Be careful: the sync is strict. When the claim lists at least one group, users are removed from any Open WebUI group not in the claim, including groups you added by hand and the default group. Admins are not exempt.
An empty or missing claim leaves memberships alone. Use OAUTH_BLOCKED_GROUPS for groups the sync should never touch. Our Open WebUI users and groups guide explains permissions per group.
Trusted Header Authentication
If a proxy already authenticates users, such as oauth2-proxy, Cloudflare Access, Tailscale Serve, Authentik or Authelia in forward-auth mode, Open WebUI can trust the email the proxy passes in a header:
WEBUI_AUTH_TRUSTED_EMAIL_HEADER=X-Forwarded-Email
WEBUI_AUTH_TRUSTED_NAME_HEADER=X-Forwarded-User
This is only safe when nothing but the proxy can reach Open WebUI. If someone can hit port 8080 directly, they can send any email in that header and sign in as that user.
Bind Open WebUI to an internal network or localhost behind the proxy. If you only need private remote access for yourself, Tailscale is often simpler; see our remote access guide.
Auto-Redirect, Logout and Other Options
| Variable | What it does |
|---|---|
OAUTH_AUTO_REDIRECT=true |
Skips the sign-in page and goes straight to the provider. Needs exactly one provider, ENABLE_LOGIN_FORM=false and no LDAP. Visit /auth?form=true for the local form |
ENABLE_LOGIN_FORM=false |
Hides the email and password form so everyone uses SSO |
WEBUI_AUTH_SIGNOUT_REDIRECT_URL |
Where users land after signing out |
OAUTH_UPDATE_PICTURE_ON_LOGIN=true |
Refreshes profile pictures from the provider |
ENABLE_OAUTH_BACKCHANNEL_LOGOUT=true |
Lets the provider sign users out server-to-server. Needs Redis |
OAUTH_TIMEOUT |
Handshake timeout in seconds for slow providers |
Open WebUI stores provider tokens encrypted in its database and refreshes them automatically, so tools and model connections that need the user’s token keep working. This is also why WEBUI_SECRET_KEY must not change.
Before hiding the login form, make sure at least one SSO user is an admin, or you can lock yourself out; our Open WebUI password reset guide helps if that happens.
Troubleshooting SSO Errors
“You do not have permission to access this resource”
No account exists for this SSO user and ENABLE_OAUTH_SIGNUP is off, the person already has a local account with that email, or role mapping refused their roles. Turn on ENABLE_OAUTH_SIGNUP=true, or OAUTH_MERGE_ACCOUNTS_BY_EMAIL=true for trusted providers, or fix the role lists.
“This email is already registered”
Sign-up is on but a local account with that email exists. Enable merge by email for providers that verify emails, or delete the old account.
Stuck on Account Activation Pending
DEFAULT_USER_ROLE is pending. Approve the user in Admin Panel > Users, set the default role to user, or use role mapping.
redirect_uri_mismatch or an error page at the provider
The callback registered with the provider does not exactly match. Compare scheme, host and path character by character, and check the proxy passes X-Forwarded-Proto.
CSRF Warning! State not equal in request and response
The session cookie was lost during the redirect. Use a fixed WEBUI_SECRET_KEY, set WEBUI_URL to the exact domain, use lax cookies, and raise OAUTH_TIMEOUT if logs show ReadTimeout. With several replicas, every instance needs the same keys and Redis.
Env var changes do nothing
OAuth settings were saved to the database and ENABLE_OAUTH_PERSISTENT_CONFIG=true. Change them in the Admin Panel, or set it to false so env vars win.
Trace the flow
Set GLOBAL_LOG_LEVEL=DEBUG and watch the logs for GET /oauth/<provider>/login returning a 302, then GET /oauth/<provider>/callback?code=.... Testing once without the reverse proxy quickly shows whether the proxy is the problem.
FAQ
Can Open WebUI use Google and Microsoft login together?
Not as two OIDC providers: only one OIDC provider is supported at a time. The docs link a community dual OAuth tutorial as a workaround for mixed setups.
Does Open WebUI support Okta and Keycloak?
Yes, through the OIDC settings. The docs include dedicated Okta and Keycloak tutorials.
Does Open WebUI support LDAP?
Yes. LDAP is a separate option in Settings > Authentication and can sit next to OAuth.
Why are the OAuth settings greyed out in the Admin Panel?
By default ENABLE_OAUTH_PERSISTENT_CONFIG=false, so env vars are authoritative and the section is read-only.
How do I make SSO users admins automatically?
Turn on ENABLE_OAUTH_ROLE_MANAGEMENT and list your provider’s admin role in OAUTH_ADMIN_ROLES.
Is SSO free in Open WebUI?
Yes. OAuth, OIDC and trusted header sign-in are part of the open source project.
Can I disable password login completely?
Yes, with ENABLE_LOGIN_FORM=false. Keep a way back in, such as /auth?form=true, before you rely on it.




