- Created architecture overview in development/architecture.md - Added installation guide in getting-started/installation.md - Developed user guide with detailed instructions in user-guide/overview.md, user-guide/teams.md, user-guide/qr-codes.md - Implemented social login setup documentation in social_login_setup.md - Updated index.md to include links to new documentation sections - Configured mkdocs.yml for site structure and theme - Added requirements.txt for documentation dependencies
7.8 KiB
Setting Up Social Login in LeagueLedger
LeagueLedger supports multiple social login (OAuth) providers to give your users various options for authentication. This document explains how to set up each supported provider.
Table of Contents
General Setup
To enable social login in LeagueLedger, you need to:
- Register your application with the desired OAuth provider(s)
- Obtain client ID and client secret credentials
- Add these credentials to your environment variables or
.envfile - Restart the application
Only providers with valid credentials will appear on the login page.
Callback URLs
Each OAuth provider requires you to configure a Redirect URI (also known as a callback URL). This is where the provider redirects users after they authenticate.
For LeagueLedger, use the following pattern:
https://your-domain.com/auth/oauth-callback/{provider_id}
Replace:
your-domain.comwith your actual domain{provider_id}with one of:google,github,facebook,microsoft,discord,linkedin, orauthentik
For local development, use:
http://localhost:8000/auth/oauth-callback/{provider_id}
Important: Most OAuth providers require exact URL matches, including protocol (http/https), domain, path, and any query parameters. Make sure to register the exact URL as shown above.
Provider-Specific Instructions
- Go to Google Cloud Console
- Create a new project or select an existing one
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Select "Web application" as the application type
- Add the following authorized redirect URI:
(Plus your production URL if applicable)
http://localhost:8000/auth/oauth-callback/google - Click "Create"
- Note the Client ID and Client Secret
- Add to your
.envfile:GOOGLE_CLIENT_ID=your-client-id GOOGLE_CLIENT_SECRET=your-client-secret
GitHub
- Go to GitHub Developer Settings
- Click "New OAuth App"
- Fill in your application details:
- Application name: "LeagueLedger"
- Homepage URL: Your app's URL or
http://localhost:8000 - Authorization callback URL:
http://localhost:8000/auth/oauth-callback/github
- Click "Register application"
- Generate a new client secret
- Add to your
.envfile:GITHUB_CLIENT_ID=your-client-id GITHUB_CLIENT_SECRET=your-client-secret
- Go to Facebook Developers
- Create a new app (choose "Consumer" or "Business" type)
- Navigate to "Add a Product" > "Facebook Login" > "Web"
- In Settings > Basic, note your App ID and App Secret
- In Facebook Login > Settings, add the following OAuth Redirect URI:
http://localhost:8000/auth/oauth-callback/facebook - Add to your
.envfile:FACEBOOK_CLIENT_ID=your-app-id FACEBOOK_CLIENT_SECRET=your-app-secret
Microsoft
- Go to Azure Portal
- Navigate to "App registrations"
- Click "New registration"
- Enter a name for your application
- For "Supported account types," choose an option based on your needs (typically "Accounts in any organizational directory and personal Microsoft accounts")
- Add the following Redirect URI (type: Web):
http://localhost:8000/auth/oauth-callback/microsoft - Click "Register"
- Note the Application (client) ID
- Create a client secret: Navigate to "Certificates & secrets" > "New client secret"
- Add to your
.envfile:Note: UseMICROSOFT_CLIENT_ID=your-client-id MICROSOFT_CLIENT_SECRET=your-client-secret MICROSOFT_TENANT=commoncommonfor multi-tenant apps, or your specific tenant ID
Discord
- Go to the Discord Developer Portal
- Click "New Application"
- Enter a name and click "Create"
- Go to the "OAuth2" section in the left sidebar
- Note the Client ID and generate a Client Secret
- Add the following redirect URL:
http://localhost:8000/auth/oauth-callback/discord - In the "OAuth2 URL Generator" section, select the "identify" and "email" scopes
- Add to your
.envfile:DISCORD_CLIENT_ID=your-client-id DISCORD_CLIENT_SECRET=your-client-secret
- Go to the LinkedIn Developer Portal
- Click "Create app"
- Fill in the required app details:
- App name: "LeagueLedger"
- LinkedIn Page: Your company's LinkedIn page (or your personal page if needed)
- App logo: Upload your app logo
- Legal agreement: Accept the terms
- Click "Create app"
- Add the "Sign In with LinkedIn" product to your app
- Configure OAuth settings:
- Authorized redirect URLs:
(Plus your production URL if applicable)
http://localhost:8000/auth/oauth-callback/linkedin
- Authorized redirect URLs:
- Under "OAuth 2.0 settings", note the Client ID and generate a Client Secret
- Request the appropriate scopes:
- r_liteprofile (for basic profile information)
- r_emailaddress (for user email address)
- Add to your
.envfile:LINKEDIN_CLIENT_ID=your-client-id LINKEDIN_CLIENT_SECRET=your-client-secret
Authentik
- Access your Authentik admin interface
- Go to "Applications" > "Providers" > "Create"
- Select "OAuth2/OIDC Provider"
- Configure the provider:
- Name: LeagueLedger
- Client Type: Confidential
- Redirect URIs:
http://localhost:8000/auth/oauth-callback/authentik - Signing Key: Select an appropriate key or create one
- Save the provider
- Create an application:
- Go to "Applications" > "Applications" > "Create"
- Name: LeagueLedger
- Slug: leagueledger
- Provider: Select the provider you just created
- Save the application
- Note the Client ID and Client Secret
- Add to your
.envfile:AUTHENTIK_CLIENT_ID=your-client-id AUTHENTIK_CLIENT_SECRET=your-client-secret AUTHENTIK_CONFIG_URL=https://your-authentik-domain/application/o/leagueledger/.well-known/openid-configuration
Troubleshooting
Common Issues:
-
Provider not showing on login page
- Check that client ID and secret are correctly set in your environment/
.envfile - Verify that values are not empty strings
- Check application logs for initialization errors
- Check that client ID and secret are correctly set in your environment/
-
Authentication Error after provider login
- Verify that the redirect URI is exactly as registered with the provider
- Check for protocol mismatch (http vs https)
- Ensure all required scopes have been granted
-
"Can't retrieve user email" errors
- Ensure you've requested the email scope from the provider
- Some providers (like GitHub) require special permissions for email access
Checking Provider Status:
You can check which providers are correctly configured by examining the login page:
- Only providers with valid credentials will appear as login options
- Look at application logs during startup for provider initialization messages
Provider-Specific Tips:
- Google: Ensure the Google+ API is enabled in your Google Cloud project
- GitHub: For private email addresses, request the
user:emailscope - Discord: Discord applications might need to be verified if you have a large user base
- Microsoft: Ensure the Microsoft Graph API permissions include User.Read
For more help, check the official documentation or open an issue on the project repository.