Overview
Configure single sign-on (SSO) authentication with OIDC, OAuth2, or SAML 2.0 providers. This guide covers the essential steps to get authentication working quickly.Choose your provider type
OIDC
RecommendedGoogle, Okta, Auth0, Azure AD, Keycloak
OAuth2
Legacy providersGitHub, GitLab, custom OAuth2
SAML 2.0
EnterpriseOkta, OneLogin, Azure AD
Quick setup
Step 1: Enable database-backed providers
Set the environment variable:Step 2: Create OAuth credentials in your IdP
- Google
- Okta
- Azure AD
- Go to Google Cloud Console
- Navigate to APIs & Services → Credentials
- Click Create Credentials → OAuth client ID
- Select Web application
-
Add redirect URI. Use the callback URL shown for the provider in Sure; for this example:
- Copy the Client ID and Client Secret
Step 3: Configure in admin UI
- Navigate to
/admin/sso_providersin your application - Click Add Provider
- Fill in the details:
- Click Save
Step 4: Test the integration
- Log out of your application
- You should see a “Sign in with Google” button (or your provider name)
- Click it and complete the authentication flow
- You should be logged in successfully
Configuration options
Local login control
Disable local email/password login to enforce SSO-only:JIT user provisioning
Control how new users are created:Role mapping
Configure default roles for new users in the admin UI under Role Mapping:- Default Role:
member(assigned to all new users) - Group Mappings: Map IdP groups to application roles
Common configurations
Pure SSO-only mode
Hybrid mode (local + SSO)
Enterprise mode (restricted domains)
@company.com emails can authenticate, and they must be pre-created by an admin.
Bootstrap first admin
The first user to register on a fresh instance is automatically assigned thesuper_admin role. No Rails console step is needed.
If you are using SSO with JIT provisioning, the first user whose login creates a new family is also automatically assigned super_admin. Subsequent users get the role defined by your provider’s default role setting.
Once a super admin exists, they can promote other users via the web UI at /admin/users.
If you need to promote a user to super_admin on an existing instance (for example, after a data migration), use the Rails console:
Troubleshooting
Provider not appearing on login page
- Verify
AUTH_PROVIDERS_SOURCE=dbis set - Check that the provider is enabled in
/admin/sso_providers - Restart the application after setting environment variables
Authentication fails
- Verify the redirect URI matches exactly in both systems
- For database-backed providers, the redirect URI is
https://your-domain.com/auth/<provider-id>/callback; copy the exact value shown in/admin/sso_providers - Check that client ID and secret are correct
- Ensure the issuer URL is accessible from your server
- Review logs at
/admin/sso_audit_logs
Email/password login fails after enabling encryption
- Do not change
SECRET_KEY_BASEon an existing instance. Self-hosted Sure derives Active Record encryption keys from it by default, and changing it prevents lookup of encrypted fields such as user email addresses. - If you added dedicated
ACTIVE_RECORD_ENCRYPTION_*keys after the instance already had data, run the encryption backfill task once. See Turning on Active Record encryption after first boot. - If the keys were changed accidentally, restore the previous
SECRET_KEY_BASEor previousACTIVE_RECORD_ENCRYPTION_*values and restart the app.
User not created automatically
- Check
AUTH_JIT_MODEis set tocreate_and_link - Verify the email domain is allowed (if
ALLOWED_OIDC_DOMAINSis set) - Ensure the IdP returns a verified email address
- Check audit logs for JIT provisioning errors
Next steps
In-depth guide
Complete authentication reference with advanced features
User management
Manage users, roles, and connected accounts