OAuth/SSO Authentication
Introduction
Section titled “Introduction”Cousins Matter supports authentication via OAuth2/OpenID Connect with multiple providers. This allows members to log in using their existing accounts from popular services like Google, Facebook, GitHub, and more. IMPORTANT: The link between the OAuth identity provider account and Cousins Matter is established using email address of the member.
Prerequisites
Section titled “Prerequisites”- Members must have a valid invitation to register via OAuth
- OAuth providers must be configured in the
.envfile - Each provider requires a client ID and client secret
Configuration
Section titled “Configuration”Enable OAuth Providers
Section titled “Enable OAuth Providers”In your .env file, define the list of providers you want to enable:
OAUTH_PROVIDERS=google,facebook,github,pocketidAvailable providers:
google- Google OAuthfacebook- Facebook OAuthapple- Apple Sign Ingithub- GitHub OAuthpocketid- PocketID (OpenID Connect)- Any other OpenID Connect compatible provider
Auto-Signup Configuration
Section titled “Auto-Signup Configuration”Control whether users need to confirm their login when using OAuth:
# Require confirmation (recommended for security)SOCIALACCOUNT_AUTO_SIGNUP=False
# Allow automatic signup without confirmationSOCIALACCOUNT_AUTO_SIGNUP=TrueDefault: False (confirmation required)
Provider-Specific Configuration
Section titled “Provider-Specific Configuration”Google OAuth
Section titled “Google OAuth”- Create a project in Google Cloud Console
- Enable the Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs:
https://yourdomain.com/accounts/google/login/callback/
Configuration in .env:
GOOGLE_OAUTH_CLIENT_ID=your_google_client_idGOOGLE_OAUTH_CLIENT_SECRET=your_google_client_secretFacebook OAuth
Section titled “Facebook OAuth”- Create an app in Facebook Developers
- Add Facebook Login product
- Configure Valid OAuth Redirect URIs:
https://yourdomain.com/accounts/facebook/login/callback/
Configuration in .env:
FACEBOOK_OAUTH_CLIENT_ID=your_facebook_app_idFACEBOOK_OAUTH_CLIENT_SECRET=your_facebook_app_secretApple Sign In
Section titled “Apple Sign In”- Register your app in Apple Developer Portal
- Create a Service ID
- Configure Sign In with Apple
Configuration in .env:
APPLE_OAUTH_CLIENT_ID=your_apple_service_idAPPLE_OAUTH_CLIENT_SECRET=your_apple_client_secretGitHub OAuth
Section titled “GitHub OAuth”- Register a new OAuth application in GitHub Settings
- Set Authorization callback URL:
https://yourdomain.com/accounts/github/login/callback/
Configuration in .env:
GITHUB_OAUTH_CLIENT_ID=your_github_client_idGITHUB_OAUTH_CLIENT_SECRET=your_github_client_secretPocketID (OpenID Connect)
Section titled “PocketID (OpenID Connect)”PocketID is a self-hosted OpenID Connect provider.
Configuration in .env:
POCKETID_SERVER_URL=https://pocketid.yourdomain.comPOCKETID_OAUTH_CLIENT_ID=your_pocketid_client_idPOCKETID_OAUTH_CLIENT_SECRET=your_pocketid_client_secretGeneric OpenID Connect Provider
Section titled “Generic OpenID Connect Provider”For any other OpenID Connect compatible provider:
Configuration in .env:
OPENID_CONNECT_SERVER_URL=https://your.openidconnect.server.comOPENID_CONNECT_OAUTH_CLIENT_ID=your_client_idOPENID_CONNECT_OAUTH_CLIENT_SECRET=your_client_secretInvitation Process
Section titled “Invitation Process”OAuth authentication in Cousins Matter requires a valid invitation:
-
For New Users:
- An admin or authorized member must send an invitation to the user’s email
- The user clicks the invitation link
- The invitation is stored in the session
- The user can then authenticate via OAuth
- The account is automatically activated
-
For Existing Inactive Users:
- If a user account exists but is not active
- The user must use the invitation link sent to their email
- After clicking the link, they can authenticate via OAuth
- The account is activated and linked to the OAuth provider
-
For Active Users:
- Active users can directly log in via OAuth
- No invitation is required
- The OAuth account is linked to their existing account
Security Considerations
Section titled “Security Considerations”- Email Verification: OAuth providers must provide an email address
- Invitation Required: New users cannot self-register without an invitation
- Session Security: Invitation tokens are stored securely in the session
- Token Expiration: Invitation tokens expire after a configurable period (see
MAX_REGISTRATION_AGEin Settings)
Troubleshooting
Section titled “Troubleshooting”“No invitation found for this email address”
Section titled ““No invitation found for this email address””This error occurs when:
- The user hasn’t clicked on an invitation link
- The invitation has expired
- The email from the OAuth provider doesn’t match the invited email
Solution: Request a new invitation from an admin with the proper email address.
“The identity provider did not provide an email address”
Section titled ““The identity provider did not provide an email address””Some OAuth providers may not share the email address.
Solution: Configure the OAuth provider to include email in the scope.
“This account is not yet active”
Section titled ““This account is not yet active””The user account exists but hasn’t been activated.
Solution: Use the invitation link sent by email before attempting OAuth login.
Restart Required
Section titled “Restart Required”After modifying OAuth settings in .env, restart Cousins Matter:
docker compose restartSee Also
Section titled “See Also”- Settings - Complete settings reference
- Installation - Initial setup
- Features - Member management features