Overview
SSO provides:- Centralized Authentication: Users log in through your identity provider
- Enhanced Security: Leverage your organization’s security policies
- Simplified Management: Centrally manage user access and permissions
- Automatic Provisioning: Works with SCIM for user lifecycle management
Prerequisites
- Cal.com Enterprise license
- Organizations feature enabled
- Separate PostgreSQL database for SAML/SSO data
- Identity Provider (IdP) supporting SAML 2.0 or OIDC
Configuration
1. Environment Variables
Add the following to your.env file:
.env
.env.example:46-55
2. Database Setup
Create a separate PostgreSQL database for SSO data:3. Jackson SSO Library
Cal.com uses BoxyHQ’s Jackson library for SSO implementation. Jackson Configuration:packages/features/ee/sso/lib/jackson.ts:19-33
SSO Admin Access
Self-Hosted
For self-hosted deployments, SSO configuration is restricted to admins listed inSAML_ADMINS:
packages/features/ee/sso/lib/saml.ts:20-30
Hosted Cal.com
For hosted deployments, SSO access is controlled by organization permissions:- Organization Owners: Full SSO configuration access
- Organization Admins: Full SSO configuration access
- Organization Members: No SSO configuration access
packages/features/ee/sso/lib/saml.ts:32-81
SSO Login Flow
1. User Initiates Login
User enters email at login screen:2. Identity Provider Authentication
3. Cal.com Processes Response
packages/features/ee/sso/lib/sso.ts:26-83
Automatic User Provisioning
SSO can automatically provision users on first login:Email Domain Matching
WhenORGANIZATIONS_AUTOLINK=1 is enabled:
packages/features/ee/sso/lib/sso.ts:34-49
Organization Assignment
Users are automatically assigned to organizations based on:- Email Domain: Matching verified organization domain
- Existing Membership: Current team memberships
- SSO Connection: Configured SSO tenant mapping
packages/features/ee/sso/lib/sso.ts:26-83
Multi-Team SSO
Cal.com supports SSO across multiple teams within an organization:packages/features/ee/sso/lib/sso.ts:56-70
SSO Tenants
Each team/organization has its own SSO tenant:- Tenant ID Format:
team-{teamId} - Product ID:
Cal.com - Audience:
https://saml.cal.com
packages/features/ee/sso/lib/saml.ts:10-18
Security Considerations
Client Secret Verification
For enhanced security during OAuth 2.0 flows:.env
client_secret during the OAuth 2.0 flow.
Source: .env.example:55
Encryption
All SSO credentials and sensitive data are encrypted using theCALENDSO_ENCRYPTION_KEY:
packages/features/ee/sso/lib/jackson.ts:29
Admin Restrictions
SSO configuration is restricted to:- Emails listed in
SAML_ADMINS(self-hosted) - Organization Owners/Admins (hosted)
packages/features/ee/sso/lib/saml.ts:32-81
Troubleshooting
SSO Not Available
Error: “To enable this feature, add value forSAML_DATABASE_URL and SAML_ADMINS to your .env”
Solution: Ensure environment variables are configured:
packages/features/ee/sso/lib/saml.ts:35-39
Permission Denied
Error: “dont_have_permission” Solutions:- Self-hosted: Add your email to
SAML_ADMINS - Hosted: Verify you have Owner or Admin role in the organization
packages/features/ee/sso/lib/saml.ts:46-74
No SSO Connection Found
Error: “Could not find a SSO Identity Provider for your email. Please contact your admin to ensure you have been given access to Cal” Solutions:- Verify SSO connection is configured for your team/organization
- Check that your email matches an existing membership
- Confirm the SSO tenant is correctly mapped
- Review SSO connection status in organization settings
packages/features/ee/sso/lib/sso.ts:72-77
User Belongs to Different Organization
Error: “User belongs to another organization.” Solution: Users can only belong to one organization. Contact support to migrate the user. Source:packages/features/ee/dsync/lib/handleUserEvents.ts:81-83
API Endpoints
SSO uses the following API endpoints:| Endpoint | Protocol | Purpose |
|---|---|---|
/api/auth/saml/callback | SAML 2.0 | SAML assertion callback |
/api/auth/oidc | OIDC | OpenID Connect authentication |
/api/scim/v2.0 | SCIM 2.0 | User provisioning (see SCIM docs) |
packages/features/ee/sso/lib/jackson.ts:21-24
Best Practices
- Use Separate Database: Always use a dedicated database for SSO data to isolate sensitive authentication information
- Rotate Secrets: Regularly rotate
SAML_CLIENT_SECRET_VERIFIERandCALENDSO_ENCRYPTION_KEY - Limit Admins: Only add necessary users to
SAML_ADMINS - Test Thoroughly: Test SSO flow in staging before production deployment
- Monitor Logs: Enable logging for SSO events to track authentication issues
- Use SCIM: Combine SSO with SCIM for automated user lifecycle management