Skip to content

OAuth/SSO Authentication

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.

  • Members must have a valid invitation to register via OAuth
  • OAuth providers must be configured in the .env file
  • Each provider requires a client ID and client secret

In your .env file, define the list of providers you want to enable:

Terminal window
OAUTH_PROVIDERS=google,facebook,github,pocketid

Available providers:

  • google - Google OAuth
  • facebook - Facebook OAuth
  • apple - Apple Sign In
  • github - GitHub OAuth
  • pocketid - PocketID (OpenID Connect)
  • Any other OpenID Connect compatible provider

Control whether users need to confirm their login when using OAuth:

Terminal window
# Require confirmation (recommended for security)
SOCIALACCOUNT_AUTO_SIGNUP=False
# Allow automatic signup without confirmation
SOCIALACCOUNT_AUTO_SIGNUP=True

Default: False (confirmation required)

  1. Create a project in Google Cloud Console
  2. Enable the Google+ API
  3. Create OAuth 2.0 credentials
  4. Add authorized redirect URIs: https://yourdomain.com/accounts/google/login/callback/

Configuration in .env:

Terminal window
GOOGLE_OAUTH_CLIENT_ID=your_google_client_id
GOOGLE_OAUTH_CLIENT_SECRET=your_google_client_secret
  1. Create an app in Facebook Developers
  2. Add Facebook Login product
  3. Configure Valid OAuth Redirect URIs: https://yourdomain.com/accounts/facebook/login/callback/

Configuration in .env:

Terminal window
FACEBOOK_OAUTH_CLIENT_ID=your_facebook_app_id
FACEBOOK_OAUTH_CLIENT_SECRET=your_facebook_app_secret
  1. Register your app in Apple Developer Portal
  2. Create a Service ID
  3. Configure Sign In with Apple

Configuration in .env:

Terminal window
APPLE_OAUTH_CLIENT_ID=your_apple_service_id
APPLE_OAUTH_CLIENT_SECRET=your_apple_client_secret
  1. Register a new OAuth application in GitHub Settings
  2. Set Authorization callback URL: https://yourdomain.com/accounts/github/login/callback/

Configuration in .env:

Terminal window
GITHUB_OAUTH_CLIENT_ID=your_github_client_id
GITHUB_OAUTH_CLIENT_SECRET=your_github_client_secret

PocketID is a self-hosted OpenID Connect provider.

Configuration in .env:

Terminal window
POCKETID_SERVER_URL=https://pocketid.yourdomain.com
POCKETID_OAUTH_CLIENT_ID=your_pocketid_client_id
POCKETID_OAUTH_CLIENT_SECRET=your_pocketid_client_secret

For any other OpenID Connect compatible provider:

Configuration in .env:

Terminal window
OPENID_CONNECT_SERVER_URL=https://your.openidconnect.server.com
OPENID_CONNECT_OAUTH_CLIENT_ID=your_client_id
OPENID_CONNECT_OAUTH_CLIENT_SECRET=your_client_secret

OAuth authentication in Cousins Matter requires a valid invitation:

  1. 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
  2. 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
  3. For Active Users:

    • Active users can directly log in via OAuth
    • No invitation is required
    • The OAuth account is linked to their existing account
  • 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_AGE in Settings)

“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.

The user account exists but hasn’t been activated.

Solution: Use the invitation link sent by email before attempting OAuth login.

After modifying OAuth settings in .env, restart Cousins Matter:

Terminal window
docker compose restart