OIDC Authentication
Overview#
OpenID Connect (OIDC) is an identity layer built on top of OAuth 2.0. It allows users to authenticate using their existing identity provider credentials instead of creating a separate account in Dawarich.
Info
OIDC authentication is only available for self-hosted Dawarich instances. Cloud-hosted instances use different authentication methods.
Prerequisites#
Before configuring OIDC, you'll need:
- A self-hosted Dawarich instance
- An OIDC-compatible identity provider (Authentik, Authelia, Keycloak, Azure AD, etc.)
- Administrator access to create an application/client in your identity provider
Environment Variables#
Configure the following environment variables in your docker-compose.yml file for both dawarich_app and dawarich_sidekiq services:
Required Variables#
| Variable | Description |
|---|---|
OIDC_CLIENT_ID |
The client ID from your identity provider |
OIDC_CLIENT_SECRET |
The client secret from your identity provider |
OIDC_ISSUER |
The issuer URL of your identity provider (enables auto-discovery) |
OIDC_REDIRECT_URI |
The callback URL: https://your-dawarich-domain/users/auth/openid_connect/callback |
Optional Variables#
| Variable | Default | Description |
|---|---|---|
OIDC_PROVIDER_NAME |
Openid Connect |
Custom display name for the login button |
OIDC_AUTO_REGISTER |
true |
Automatically create accounts for new OIDC users |
OIDC_PKCE_ENABLED |
false |
Enable PKCE (S256) for the authorization code flow. Required when your OIDC client enforces PKCE (e.g. Pocket ID, hardened Authentik/Keycloak) |
ALLOW_EMAIL_PASSWORD_REGISTRATION |
false |
Allow traditional email/password account registration alongside OIDC |
ALLOW_EMAIL_PASSWORD_LOGIN |
true |
Allow signing in with email/password. Set to false to hide the email/password form and force OIDC-only sign-in |
Manual Endpoint Configuration (Alternative to Discovery)#
If your identity provider doesn't support OIDC discovery, you can configure endpoints manually:
| Variable | Description |
|---|---|
OIDC_HOST |
The hostname of your identity provider |
OIDC_SCHEME |
Protocol (https or http, default: https) |
OIDC_PORT |
Port number (default: 443) |
OIDC_AUTHORIZATION_ENDPOINT |
Authorization endpoint path (default: /authorize) |
OIDC_TOKEN_ENDPOINT |
Token endpoint path (default: /token) |
OIDC_USERINFO_ENDPOINT |
User info endpoint path (default: /userinfo) |
Configuration Example#
Here's an example configuration in your docker-compose.yml:
services:
dawarich_app:
image: freikin/dawarich:latest
environment:
# ... other environment variables ...
OIDC_CLIENT_ID: your-client-id
OIDC_CLIENT_SECRET: your-client-secret
OIDC_ISSUER: https://auth.yourdomain.com
OIDC_REDIRECT_URI: https://dawarich.yourdomain.com/users/auth/openid_connect/callback
OIDC_PROVIDER_NAME: "Sign in with Authentik"
OIDC_AUTO_REGISTER: "true"
ALLOW_EMAIL_PASSWORD_REGISTRATION: "false"
ALLOW_EMAIL_PASSWORD_LOGIN: "false"
# ... rest of configuration ...
dawarich_sidekiq:
image: freikin/dawarich:latest
environment:
# Same OIDC environment variables
OIDC_CLIENT_ID: your-client-id
OIDC_CLIENT_SECRET: your-client-secret
OIDC_ISSUER: https://auth.yourdomain.com
OIDC_REDIRECT_URI: https://dawarich.yourdomain.com/users/auth/openid_connect/callback
OIDC_PROVIDER_NAME: "Sign in with Authentik"
OIDC_AUTO_REGISTER: "true"
ALLOW_EMAIL_PASSWORD_REGISTRATION: "false"
ALLOW_EMAIL_PASSWORD_LOGIN: "false"
# ... rest of configuration ...Provider Setup Examples#
Authentik#
- Log in to your Authentik admin interface
- Go to Applications → Providers → Create
- Select OAuth2/OpenID Provider
- Configure the provider:
- Name: Dawarich
- Authorization flow: Select an appropriate flow
- Client type: Confidential
- Redirect URIs:
https://dawarich.yourdomain.com/users/auth/openid_connect/callback
- Save and note the Client ID and Client Secret
- Go to Applications → Applications → Create
- Link the provider to the application
- Your issuer URL is typically:
https://authentik.yourdomain.com/application/o/dawarich/
Keycloak#
- Log in to your Keycloak admin console
- Select your realm (or create a new one)
- Go to Clients → Create client
- Configure:
- Client type: OpenID Connect
- Client ID:
dawarich
- On the next screen:
- Client authentication: On
- Valid redirect URIs:
https://dawarich.yourdomain.com/users/auth/openid_connect/callback
- Save and go to the Credentials tab to get the Client Secret
- Your issuer URL is:
https://keycloak.yourdomain.com/realms/your-realm
Authelia#
- Add a client configuration to your Authelia configuration:
identity_providers:
oidc:
clients:
- id: dawarich
description: Dawarich Location History
secret: 'your-secret-hash'
public: false
authorization_policy: two_factor
redirect_uris:
- https://dawarich.yourdomain.com/users/auth/openid_connect/callback
scopes:
- openid
- email
- profile- Your issuer URL is typically:
https://auth.yourdomain.com
Azure AD / Entra ID#
- Go to Azure Portal → Azure Active Directory → App registrations
- Click New registration
- Configure:
- Name: Dawarich
- Redirect URI:
https://dawarich.yourdomain.com/users/auth/openid_connect/callback
- After creation, go to Certificates & secrets → New client secret
- Note the Application (client) ID and the secret value
- Your issuer URL is:
https://login.microsoftonline.com/your-tenant-id/v2.0
Testing the Integration#
-
Restart your Dawarich containers after updating environment variables:
docker compose down && docker compose up -d -
Navigate to your Dawarich login page
-
You should see a button with your custom provider name (or "Sign in with Openid Connect")
-
Click the button to be redirected to your identity provider
-
After authentication, you'll be redirected back to Dawarich
User Registration Behavior#
Auto-Registration Enabled (OIDC_AUTO_REGISTER=true)#
When a user authenticates via OIDC for the first time:
- A new Dawarich account is automatically created
- The email address from the OIDC provider is used
- The user is logged in immediately
Auto-Registration Disabled (OIDC_AUTO_REGISTER=false)#
When a user authenticates via OIDC:
- They must have an existing Dawarich account with the same email
- No new accounts are created automatically
- Users without existing accounts will see an error
Disabling Email/Password Sign-In#
To use OIDC as the only authentication method:
OIDC_AUTO_REGISTER: "true"
ALLOW_EMAIL_PASSWORD_REGISTRATION: "false"
ALLOW_EMAIL_PASSWORD_LOGIN: "false"This ensures all users must authenticate through your identity provider.
ALLOW_EMAIL_PASSWORD_REGISTRATION: "false" only blocks creating new accounts with email/password — on its own it does not hide the email/password sign-in form. To remove that form and force OIDC-only sign-in you must also set ALLOW_EMAIL_PASSWORD_LOGIN: "false". (Before v1.7.8 a single variable controlled both; sign-in is now gated by ALLOW_EMAIL_PASSWORD_LOGIN.)
Troubleshooting#
"Invalid credentials" after OIDC login#
- Verify the email from OIDC matches an existing account (if auto-registration is disabled)
- Check that
OIDC_AUTO_REGISTERis set totrueif you want automatic account creation
Redirect URI mismatch#
- Ensure the
OIDC_REDIRECT_URIexactly matches what's configured in your identity provider - Check for trailing slashes
- Verify the protocol (http vs https)
Discovery fails#
- Verify the
OIDC_ISSUERURL is accessible - Try appending
/.well-known/openid-configurationto the issuer URL in a browser - If discovery doesn't work, try manual endpoint configuration
OIDC button doesn't appear#
- Check that both
OIDC_CLIENT_IDandOIDC_CLIENT_SECRETare set - Verify
SELF_HOSTED=true(default for self-hosted instances) - Check container logs for OIDC configuration messages
SSL/Certificate errors#
- Ensure your identity provider's SSL certificate is valid
- If using self-signed certificates, you may need to configure certificate trust
Security Considerations#
- Always use HTTPS for both Dawarich and your identity provider in production
- Keep your client secret secure and never commit it to version control
- Consider using two-factor authentication in your identity provider
- Regularly rotate client secrets according to your security policy