OIDC/OAuth Authentication
This guide explains how to configure Palpo to authenticate users using OAuth 2.0 / OpenID Connect (OIDC) providers such as GitHub, Google, GitLab, and other identity providers.
Overview
OIDC authentication allows users to sign in to Palpo using their existing accounts from external identity providers. This provides a convenient single sign-on (SSO) experience and eliminates the need for users to manage separate Matrix passwords.
Prerequisites
- An OAuth application registered with your chosen provider(s)
- The client ID and client secret from your OAuth application
- A publicly accessible callback URL for your Palpo server
Basic Configuration
Add the following section to your palpo.toml configuration file:
Provider Configuration
Each provider needs its own configuration section under [oidc.providers.<name>]:
GitHub
To create a GitHub OAuth App:
- Go to GitHub Settings → Developer Settings → OAuth Apps → New OAuth App
- Set the Homepage URL to your Palpo server URL
- Set the Authorization callback URL to
https://your-server/_matrix/client/oidc/callback - Copy the Client ID and generate a Client Secret
To create a Google OAuth Client:
- Go to the Google Cloud Console
- Create or select a project
- Go to APIs & Services → Credentials → Create Credentials → OAuth 2.0 Client IDs
- Set Application type to "Web application"
- Add your callback URL to Authorized redirect URIs
GitLab
Self-Hosted Keycloak
Configuration Options
Global Options
Provider Options
User ID Mapping
Palpo automatically determines the Matrix user ID from provider information:
- Username (preferred): GitHub login,
preferred_usernameclaim - Email prefix:
johnfromjohn@example.com - Provider ID: Falls back to provider's unique identifier
To add a prefix to distinguish OAuth users:
Custom Attribute Mapping
Map OIDC claims to Matrix user attributes:
Multiple Providers
You can configure multiple providers simultaneously:
Security Considerations
- Keep secrets secure: Never commit
client_secretvalues to version control - Use HTTPS: Always use HTTPS for the callback URL
- Enable PKCE: Keep
enable_pkce = truefor additional security - Verify emails: Keep
require_email_verified = truewhen possible - Restrict registration: Set
allow_registration = falseif you only want existing users to use OAuth
Login Flow
- User clicks "Sign in with [Provider]" on the Matrix client
- Client redirects to
/_matrix/client/oidc/auth?provider=<name> - Palpo redirects to the OAuth provider's authorization page
- User authenticates and grants permissions
- Provider redirects back to Palpo's callback URL
- Palpo exchanges the code for tokens and creates/authenticates the user
- User is logged in to Matrix
Troubleshooting
"Invalid redirect_uri" Error
- Ensure the
redirect_uriin your config exactly matches what's configured in the OAuth provider - Check for trailing slashes or protocol mismatches (http vs https)
"User not found" Error
- If
allow_registration = false, the user must already exist in Matrix - Check that the email/username mapping is working correctly
Session Timeout Issues
- Increase
session_timeoutif users frequently fail to complete the OAuth flow - Default is 600 seconds (10 minutes)
Private Email Issues (GitHub)
- Some users have private GitHub emails
- Set
require_email_verified = falseto allow login without verified emails - Or request the
user:emailscope to access primary email even if private