Skip to main content

Overview

Open WebUI supports OAuth 2.0 and OpenID Connect for Single Sign-On (SSO) with multiple identity providers. Enable seamless authentication with Google, Microsoft, GitHub, Feishu, or any OIDC-compliant provider.

Supported Providers

Google

Google OAuth 2.0 authentication

Microsoft

Azure AD / Microsoft Entra ID

GitHub

GitHub OAuth Apps

Generic OIDC

Okta, Auth0, Keycloak, etc.

Feishu

Lark/Feishu authentication

Trusted Headers

Proxy-based authentication

Quick Start

1

Choose Provider

Select your identity provider (Google, Microsoft, etc.)
2

Register OAuth Application

Create OAuth app in your provider’s console
3

Configure Open WebUI

Set environment variables with client ID and secret
4

Enable OAuth Signup

Allow user registration via OAuth

Google OAuth

Setup

1

Create OAuth Client

  1. Go to Google Cloud Console
  2. Navigate to APIs & Services > Credentials
  3. Create OAuth 2.0 Client ID (Web application)
  4. Add authorized redirect URI: https://your-domain.com/oauth/google/callback
2

Configure Open WebUI

File: backend/open_webui/config.py:351

Configuration Options

Microsoft OAuth

Setup

1

Register Application

  1. Go to Azure Portal
  2. Navigate to Azure Active Directory > App registrations
  3. Create new registration
  4. Add redirect URI: https://your-domain.com/oauth/microsoft/callback
  5. Create a client secret under Certificates & secrets
2

Configure Open WebUI

File: backend/open_webui/config.py:376

Advanced Configuration

File: backend/open_webui/config.py:402

GitHub OAuth

Setup

1

Create OAuth App

  1. Go to GitHub Settings > Developer settings > OAuth Apps
  2. Click “New OAuth App”
  3. Set Homepage URL: https://your-domain.com
  4. Set Authorization callback URL: https://your-domain.com/oauth/github/callback
2

Configure Open WebUI

File: backend/open_webui/config.py:424

Generic OIDC Provider

Connect to any OpenID Connect provider (Okta, Auth0, Keycloak, etc.).

Configuration

File: backend/open_webui/config.py:448

Advanced OIDC Options

File: backend/open_webui/config.py:484

Role and Group Management

Role Mapping

Map OAuth roles to Open WebUI roles:
File: backend/open_webui/config.py:557

Group Management

Automatically sync OAuth groups to Open WebUI:
File: backend/open_webui/config.py:563

Domain Restrictions

Restrict access to specific email domains:
File: backend/open_webui/config.py:630

Claim Mapping

Customize which JWT claims to use for user attributes:
File: backend/open_webui/config.py:502

Custom Claims Example

User Profile Updates

Control whether OAuth updates user profiles on login:
File: backend/open_webui/config.py:639

Account Merging

Merge OAuth accounts with existing email-based accounts:
Enabling account merging allows OAuth users to take over existing accounts with matching emails. Only enable if you trust your OAuth provider’s email verification.
File: backend/open_webui/config.py:343

Session Management

File: backend/open_webui/env.py:593

LDAP Integration

Open WebUI includes LDAP support for enterprise directory services.
File: backend/requirements.txt:140
LDAP configuration is typically handled through custom authentication pipelines or enterprise features.

Multiple Provider Setup

Enable multiple OAuth providers simultaneously:
Users will see all configured providers on the login page. File: backend/open_webui/utils/oauth.py:939

Troubleshooting

Error: redirect_uri_mismatchSolution:
  1. Verify redirect URI in OAuth provider matches exactly
  2. Include protocol (https://)
  3. Check for trailing slashes
  4. Ensure callback path is correct:
    • Google: /oauth/google/callback
    • Microsoft: /oauth/microsoft/callback
    • GitHub: /oauth/github/callback
    • OIDC: /oauth/oidc/callback
OAuth succeeds but no user account created.Solution:
  • Enable ENABLE_OAUTH_SIGNUP=True
  • Check domain restrictions in OAUTH_ALLOWED_DOMAINS
  • Verify required claims are present (email, name)
  • Review role restrictions in OAUTH_ALLOWED_ROLES
  • Check logs for detailed error messages
Users not properly logged out.Solution:
The OPENID_PROVIDER_URL is required for proper logout functionality.
OAuth roles or groups not syncing.Solution:
  • Verify claim names match provider (check JWT)
  • Check separator configuration
  • Enable group creation if needed
  • Review OAUTH_BLOCKED_GROUPS configuration
  • Ensure claims are included in token response

Security Best Practices

Use HTTPS

Always use HTTPS for production OAuth

Secure Secrets

Store client secrets in environment variables or secrets manager

Validate Emails

Only enable account merging with trusted email verification

Limit Sessions

Configure OAUTH_MAX_SESSIONS_PER_USER

Domain Restrictions

Use OAUTH_ALLOWED_DOMAINS to restrict access

Audit Logging

Enable logging for OAuth authentication events

Advanced Features

Persistent OAuth Config

Enable database-backed OAuth configuration:
This allows OAuth settings to be managed through the admin panel. File: backend/open_webui/config.py:332

Email Fallback

Allow OAuth signup even without email in claims:
File: backend/open_webui/env.py:589

Client Info Encryption

Encrypt OAuth client information:
File: backend/open_webui/env.py:597

Testing OAuth Configuration

  1. Test Provider Connection:
    • Visit login page
    • Click OAuth provider button
    • Verify redirect to provider
  2. Test User Creation:
    • Complete OAuth flow
    • Check if user is created
    • Verify role/group assignment
  3. Test Claims:
    • Decode JWT token
    • Verify required claims present
    • Check claim values
  4. Test Logout:
    • Log in via OAuth
    • Log out
    • Verify session cleared

References