Single sign-on sends the browser on a round trip from Open WebUI to an identity provider such as Keycloak and back to a registered callback address, where Open WebUI matches the reply against a state value kept in a browser cookie. When an SSO login fails in Open WebUI, the screen where that round trip stops points to the address or cookie that disagrees, and correcting it lets the affected user reach the workspace again.
OPENID_REDIRECT_URI sets the callback for every sign-in, whichever address the browser started from, and Keycloak accepts it only when the client's Valid redirect URIs list holds that exact address. The state cookie belongs to the host name that set it, so a sign-in started at localhost cannot finish at 127.0.0.1. After a successful callback, Open WebUI sends the browser to the WebUI URL saved in its admin settings, and the new session exists there only when that address shares the callback's host name.
Password sign-in with a local administrator account does not pass through the identity provider, so it remains the way back in while SSO is broken. Loosening the provider side hides symptoms at a cost, because a wildcard redirect URI lets Keycloak send sign-in codes to any matching address and merging accounts by email can attach an SSO identity to an existing local account. A sign-in that completes can still stop at Account Activation Pending, since new accounts receive the pending role until an administrator approves them.
The addresses http://localhost:3864 and http://127.0.0.1:3864 are replaceable examples for the affected user's starting address and the callback's origin. In every command and browser retry, substitute your own addresses, including their scheme and port. For a public deployment, the intended origin might be https://openwebui.example.com and its callback https://openwebui.example.com/oauth/oidc/callback. The callback comes from your OPENID_REDIRECT_URI; its origin is the scheme, host name and port without the path. The Corporate realm and open-webui client are example names for the realm in your OPENID_PROVIDER_URL and the client in your OAUTH_CLIENT_ID.
Steps to troubleshoot SSO login failures in Open WebUI:
- Sign in to Open WebUI with the local administrator's email and password in a normal browser window.
This session stays open as the way back in while SSO is broken, and it carries the administrator changes that some fixes need. Password sign-in does not involve Keycloak. Closing all private windows ends their sign-ins while this normal window stays open.
- Close every private browser window.
In Chrome, private windows share cookies until all of them close, so an additional private window can reuse an earlier sign-in.
- Click Continue with Keycloak on the Open WebUI sign-in page at the affected user's usual address in a new private browser window.
The button carries the OAUTH_PROVIDER_NAME label, Keycloak here. If Keycloak shows Invalid parameter: redirect_uri instead of a sign-in form, the redirect URI repair applies immediately.
- Sign in on the Keycloak page as the affected user.
After sign-in returns to Open WebUI, the observed screen determines the repair. A failed identity provider sign-in applies to the failure message, a return to the sign-in page without a message applies to a sign-in loop, and Account Activation Pending applies to a completed sign-in that waits for approval.
Keycloak rejects the redirect URI
- Confirm that Keycloak shows Invalid parameter: redirect_uri instead of its sign-in form.
Keycloak refuses the request before asking for a password because the callback address in it is missing from the client's Valid redirect URIs list.
- Display the callback address that Open WebUI sends to Keycloak. Example output:
$ curl -s -o /dev/null -w '%{redirect_url}\n' http://127.0.0.1:3864/oauth/oidc/login | grep -o 'redirect_uri=[^&]*' redirect_uri=http%3A%2F%2F127.0.0.1%3A3864%2Foauth%2Foidc%2Fcallback
http://127.0.0.1:3864 represents your intended Open WebUI origin, and /oauth/oidc/login is the address behind Continue with Keycloak. curl prints the redirect without following it, and grep keeps only its redirect_uri part. With
%3Aread as a colon and%2Fas a slash, the callback is http://127.0.0.1:3864/oauth/oidc/callback, which Open WebUI takes from OPENID_REDIRECT_URI. - Click open-webui on the Clients page of the Corporate realm in the Keycloak admin console.
The client ID matches OAUTH_CLIENT_ID, and the realm is the one named after /realms/ in OPENID_PROVIDER_URL.
- Replace the Valid redirect URIs entry with the decoded callback address.
The old entry ends in /oauth/callback without the oidc part. Keycloak compares the whole address, so the scheme, host name, port and path must all match.
An entry ending in
*would also clear the error, but Keycloak would then return sign-in codes to any address that starts with the same text. - Click Save at the bottom of the client settings.
Client successfully updated confirms the corrected entry.
- Click Continue with Keycloak on the Open WebUI sign-in page again.

- Sign in on the Keycloak page as the affected user.
The sign-in form in place of the error shows that Keycloak now accepts the callback address.
- Confirm that the Open WebUI workspace opens for the affected user.
Hello, Riley Chen greets the test user from Keycloak. An account signing in for the first time stops at Account Activation Pending instead until an administrator approves it.
Open WebUI reports a failed identity provider sign-in
- Confirm that Open WebUI returns to its sign-in page with Sign-in with your identity provider failed.
The message closes after a few seconds. The browser now shows the address from the saved WebUI URL, not the one where the sign-in started.
- Search the Open WebUI container log for the latest OAuth callback error. Example output:
$ docker logs open-webui 2>&1 | grep 'OAuth callback error' | tail -n 1 2026-11-14 23:19:25.247 | WARNING | open_webui.utils.oauth:handle_callback:1998 - OAuth callback error during authorize_access_token for provider oidc: OAuth callback failed: mismatching_state: CSRF Warning! State not equal in request and response.
open-webui is the container name. mismatching_state means the callback arrived without the session cookie that holds the state value saved when the sign-in started. Another reason after OAuth callback failed: belongs to a different fault.
Related: How to view Open WebUI Docker logs - Display the callback address for a sign-in that starts at the address the affected user opened. Example output:
$ curl -s -o /dev/null -w '%{redirect_url}\n' http://localhost:3864/oauth/oidc/login | grep -o 'redirect_uri=[^&]*' redirect_uri=http%3A%2F%2F127.0.0.1%3A3864%2Foauth%2Foidc%2Fcallback
The sign-in starts at localhost, but the callback goes to 127.0.0.1, a different host name. The browser keeps the owui-session cookie with localhost, so the callback at 127.0.0.1 cannot read the saved state.
- Click Continue with Keycloak on the sign-in page at http://127.0.0.1:3864.
Starting at the callback's host name keeps the state cookie in place when Keycloak returns, so links and bookmarks for users need this same address. Moving users to a different address instead means changing OPENID_REDIRECT_URI and WEBUI_URL in the container environment, the Keycloak Valid redirect URIs entry and the saved WebUI URL to that address together.
- Confirm that the Open WebUI workspace opens for the affected user.
Keycloak can return without asking for the password again while its sign-in from the failed attempt is still active.
Open WebUI returns to the sign-in page without a message
- Confirm that Open WebUI returns to its sign-in page without an error message.
The container log records no OAuth callback error for this attempt, because the callback itself succeeded.
- Display the callback address that Open WebUI sends to Keycloak. Example output:
$ curl -s -o /dev/null -w '%{redirect_url}\n' http://localhost:3864/oauth/oidc/login | grep -o 'redirect_uri=[^&]*' redirect_uri=http%3A%2F%2Flocalhost%3A3864%2Foauth%2Foidc%2Fcallback
The callback goes to http://localhost:3864, where Open WebUI creates the new session. It then sends the browser to the saved WebUI URL, and a WebUI URL with another host name opens a page where that session does not exist.
- Click Admin Panel in the user menu of the local administrator's window.
The user menu opens from the account picture at the bottom left.
- Click Settings at the top of the Admin Panel.

- Replace the WebUI URL value under General with the scheme, host name and port of the callback address.
The saved value here, http://127.0.0.1:3864, still names the address in use before OPENID_REDIRECT_URI moved to localhost. The new value is http://localhost:3864, without the callback path.
The saved WebUI URL outranks WEBUI_URL from the container environment while ENABLE_PERSISTENT_CONFIG keeps its default. With ENABLE_PERSISTENT_CONFIG=false, the next container re-creation replaces it with WEBUI_URL, which then needs the same address.
Related: How to troubleshoot ignored environment variables in Open WebUI - Click Save in the General settings.
Settings saved successfully! confirms the change, which takes effect without a container restart.
- Close every private browser window.
The normal local-administrator window stays open. Closing all private windows removes the earlier private session, including the token created during the failed attempt.
- Click Continue with Keycloak on the sign-in page at your callback's origin in a new private window.
The callback origin here is http://localhost:3864, replaced by your own address. The fresh private session must show the sign-in page before the retry.
- Sign in on the Keycloak page as the affected user.

- Confirm that the Open WebUI workspace opens for the affected user.

Open WebUI shows Account Activation Pending
- Confirm that Open WebUI shows Account Activation Pending.
The SSO sign-in itself worked. New accounts receive the pending role by default and wait on this screen until an administrator approves them.
- Click Admin Panel in the user menu of the local administrator's window.

- Click Pending beside the affected user under Users.
The role button opens Edit User for that account.
- Select User in the Role list of Edit User.
Admin would give the account control of every user and setting in Open WebUI.
- Click Save in Edit User.
A default role of user instead gives every account that can sign in through Keycloak workspace access at once, so it suits only a Keycloak client limited to approved people. DEFAULT_USER_ROLE sets that default in the environment, and a role already saved in the admin settings takes precedence over it.
- Click Check Again on the affected user's Account Activation Pending screen.

- Confirm that the Open WebUI workspace opens for the affected user.
