Skip to content

OAuth failure #175

Closed as not planned
Closed as not planned

Description

@aarononeal

OAuth via Authentik fails to sign in. During redirect the web view opens a browser window instead and doesn't complete the handshake leading to the following error on the server. Signing into the website in a browser works fine.

authlib.integrations.base_client.errors.MismatchingStateError: mismatching_state: CSRF Warning! State not equal in request and response.

Activity

  1. timhagel commented on May 3, 2026

    @timhagel

    Same error using pocket-id for auth. Like @aarononeal said, it looks like the OAuth redirect url isn't being handled.

    Edit: Just for extra context I experienced this on mac

  2. alvaroc20 commented on May 5, 2026

    @alvaroc20

    Environment

    • Open WebUI Desktop: 0.0.18
    • Package: .deb
    • OS: Linux
    • Remote Open WebUI server
    • Auth provider: Google OAuth / Google Workspace
    • Browser login to the same Open WebUI server works correctly.

    What happens

    I'm hitting the same issue with the desktop app + a remote Open WebUI instance configured with Google SSO. After completing the Google login (including 2FA), the desktop ends up on a Google 400. That's an error. The server cannot process the request
    because it is malformed page, and the user is never logged in.

    What the logs show

    On the desktop side, mid-flow it explicitly hands the OAuth consent URL to the system browser:

    › Opening URL in browser: https://accounts.google.com/signin/oauth/legacy/consent?...

    On the Open WebUI server side, the callback then arrives without the session that was started inside the Electron webview, so authlib rejects it:

    WARNING | open_webui.utils.oauth:handle_callback - OAuth callback error during authorize_access_token for provider google: OAuth callback failed: mismatching_state: CSRF Warning! State not equal in request and response.

    authlib.integrations.base_client.errors.MismatchingStateError: mismatching_state: CSRF Warning! State not equal in request and response.
    ERROR    | open_webui.utils.oauth:handle_callback - Error during OAuth process: 400: The email or password provided is incorrect. Please check for typos and try logging in again.
    INFO     | "GET /oauth/google/callback HTTP/1.1" 307
    INFO     | "GET /auth?error=The+email+or+password+provided+is+incorrect.+Please+check+for+typos+and+try+logging+in+again. HTTP/1.1" 206
    

    The renderer also reports:

    "No token found in localStorage, user-join event not emitted"

    Why it fails

    The OAuth state / session cookie is set on the request that the Electron webview makes to /oauth/google/login. When the consent URL is opened in the system browser instead of being completed inside the webview, the final redirect to
    /oauth/google/callback?state=...&code=... reaches the server from a different browser context with no matching session cookie, so authlib raises MismatchingStateError. The "Google 400 / malformed" page seems to be the desktop trying to handle/intercept
    that callback URL a second time after the server has already redirected to /auth?error=....

    Confirmed working

    • Same server, same Google OAuth client, accessed from a regular browser → SSO works fine end to end.
    • Desktop with email/password login form against the same server → works.

    So the server config and Google OAuth client are healthy; the breakage is specifically the desktop pushing the OAuth flow out to the system browser, which loses the session continuity required for the state check.

    Happy to provide more logs if useful

    Image
  3. vk2r commented on May 5, 2026

    @vk2r

    The "open URL in browser" implementation currently has an issue: it should only function when the URL is being processed by an OpenWebUI instance. A possible solution would be to add a query parameter to the web page to determine if the OpenWebUI instance has been successfully loaded.

  4. Zekbold commented on May 22, 2026

    @Zekbold

    I have just installed the OpenWeb UI desktop software on a new machine, and encountered this error. I have Cloudflare Access handling SSO, and Google and GitHub being the two identity providers set up in Access. This all works fine in many other scenarios.

    On my previous device, shortly after OWU desktop was launched this flow worked fine - the SSO process happened entirely within the OWU desktop software, it passed the CF auth headers to OWU successfully, and log in works correctly. It was only when I installed it on a second device today that I encountered this error.

    So this seems to have been a recently-introduced bug.

  5. chriswilsonuk commented on Aug 30, 2026

    @chriswilsonuk

    +1 for the issue with JumpCloud SSO.

    Opening SSO in external browser window causes authentication success not to make it back to desktop app.

  6. freshprincekeem commented on Sep 30, 2026

    @freshprincekeem

    Just confirmed this is still happening on Open WebUI Desktop 0.0.20 on an Apple Silicon Mac, connecting to Open WebUI 0.11.4 behind Authentik.

    Authentik says the login was successful, but the callback opens in the regular browser and the Desktop app stays stuck on the loading screen. Signing in through a normal browser works fine.

    I also tested the same account with Open WebUI's email/password login in the Desktop app. That works and stays signed in after quitting and reopening the app, so the problem seems limited to the OAuth handoff between the browser and Desktop.

    Tested September 30, 2026. Happy to test a fix if that helps.

  7. tjbck commented on Nov 1, 2026

    @tjbck
    Contributor

    Remote instances are no longer a part of the scope of Desktop, https://github.com/open-webui/tether may address this in the future.

  8. locked and limited conversation to collaborators on Nov 1, 2026
  9. converted this issue into a discussion #303 on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions