Overview
The Social Authentication settings page allows administrators to configure OAuth providers for social login. Users can then sign in with their existing accounts from GitHub, Google, Twitter/X, Apple, or Facebook - no password needed!Accessing Social Authentication Settings
- Log in to Admin Panel - Navigate to
/admin - Click “Settings” in the sidebar
- Select “Social Authentication”
How Social Login Works
User Experience
- User clicks “Continue with GitHub” (or other provider) on login page
- Redirected to provider (e.g., GitHub) for authorization
- User approves access to their account
- Redirected back to your app
- Automatically logged in - Account created if first time
What Gets Stored
When a user signs in via social provider:- ✅ Basic profile - Name, email, avatar
- ✅ Provider ID - Their account ID on that platform
- ✅ OAuth token - Encrypted access token (if needed)
- ❌ Password - Not stored (they don’t have one!)
Global Toggle
Use Social Authentication
- Field:
AUTH_USE_SOCIAL_AUTH - Type: Toggle (On/Off)
- Default: ON
- ✅ Social login buttons appear on login/registration pages
- ✅ Users can sign in with configured providers
- ❌ All social login buttons hidden
- ❌ Social login routes disabled
- ✅ Only email/password login available
Supported Providers
GitHub
Perfect for developer tools, technical products, and open-source projects. Configuration:GITHUB_CLIENT_ID- GitHub OAuth App Client IDGITHUB_CLIENT_SECRET- GitHub OAuth App Secret
- Go to GitHub Developer Settings
- Click “New OAuth App”
- Fill in:
- Application name: Your App Name
- Homepage URL:
https://yourapp.com - Authorization callback URL:
https://yourapp.com/auth/callback/github
- Click “Register application”
- Copy Client ID and generate/copy Client Secret
- Paste into admin panel and save
GOOGLE_CLIENT_ID- Google OAuth Client IDGOOGLE_CLIENT_SECRET- Google OAuth Client Secret
- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google+ API
- Go to Credentials → Create Credentials → OAuth Client ID
- Choose Web application
- Add authorized redirect URI:
https://yourapp.com/auth/callback/google - Copy Client ID and Client Secret
- Paste into admin panel and save
Twitter / X
Great for social media tools, news apps, content platforms. Configuration:TWITTER_CLIENT_ID- Twitter OAuth 2.0 Client IDTWITTER_CLIENT_SECRET- Twitter OAuth 2.0 Client Secret
- Go to Twitter Developer Portal
- Create a new app or select existing
- Go to app settings → User authentication settings
- Enable OAuth 2.0
- Set Type of App: Web App
- Add callback URL:
https://yourapp.com/auth/callback/twitter - Copy Client ID and Client Secret
- Paste into admin panel and save
Apple
Required for iOS apps, great for privacy-focused users. Configuration:APPLE_CLIENT_ID- Service ID (Identifier)APPLE_CLIENT_SECRET- Not used directlyAPPLE_TEAM_ID- Your Apple Team IDAPPLE_KEY_ID- Key ID from Apple DeveloperAPPLE_PRIVATE_KEY- Contents of .p8 file
- Go to Apple Developer
- Certificates, IDs & Profiles → Identifiers
- Create App ID (if you haven’t)
- Create Services ID:
- Identifier (Service ID):
com.yourapp.signin - Enable “Sign in with Apple”
- Configure Web Domain and Return URL:
https://yourapp.com/auth/callback/apple
- Identifier (Service ID):
- Create Key:
- Enable “Sign in with Apple”
- Download the
.p8file - Note the Key ID
- Find your Team ID in membership details
- Enter all values in admin panel:
- Client ID = Service ID
- Team ID = Your Team ID
- Key ID = Key ID from key creation
- Private Key = Contents of .p8 file (open in text editor and paste)
FACEBOOK_CLIENT_ID- Facebook App IDFACEBOOK_CLIENT_SECRET- Facebook App Secret
- Go to Facebook Developers
- Create a new app → Consumer type
- Add Facebook Login product
- Configure Facebook Login Settings:
- Valid OAuth Redirect URIs:
https://yourapp.com/auth/callback/facebook
- Valid OAuth Redirect URIs:
- Go to Settings → Basic
- Copy App ID (Client ID) and App Secret (Client Secret)
- Paste into admin panel and save
Configuring a Provider
Step-by-Step
- Navigate to Settings → Social Authentication
- Enable “Use Social Authentication” (if not already)
- Expand the provider section (e.g., click “GitHub”)
- Enter Client ID and Client Secret
- For Apple: Also enter Team ID, Key ID, and Private Key
- Click “Save Changes”
- Test - Social login buttons should appear on login page
Visual Elements
Each provider section features:- 🔽 Collapsible section - Expand to see fields
- 👁️ Revealable secrets - Click eye icon to show/hide
- ✅ Validation - Ensures required fields are filled
- 💾 Live updates - Changes save to
.envfile
How It Works Behind the Scenes
OAuth Flow
Database Storage
User Account:- Created in
userstable with provider email - No password set (social auth users don’t need one)
- Stored in
social_accountstable - Links user to their provider account
- Stores encrypted OAuth token
- Columns:
user_id,provider,account_id,token
app/Models/SocialAccount.php
Configuration Files
Social auth credentials flow through Laravel’s configuration:.env → config/services.php → OAuth Controllers
Example from config/services.php:
Social Login UI Components
Where Buttons Appear
Social login buttons automatically appear on:- ✅ Login page (
/login) - ✅ Registration page (
/register)
Button Behavior
Each button:- Only appears if both Client ID and Secret are configured
- Shows provider logo and “Continue with [Provider]” text
- Styled consistently with your app’s design
- Located in:
resources/views/components/social/
Customizing Buttons
Button Component Location:resources/views/components/social/buttons.blade.php
You can customize:
- Button text
- Button styling
- Button order
- Which buttons to show
Testing Social Login
Development Testing
-
Use ngrok or similar for localhost OAuth:
Use ngrok URL as callback URL in provider settings
-
Test each provider:
- Click social login button
- Authorize on provider site
- Should redirect back and log you in
- Check user created in database
-
Test scenarios:
- ✅ New user sign up
- ✅ Existing user sign in
- ✅ Link multiple providers to same account (if supported)
Production Testing
- Update callback URLs to production domain
- Enable HTTPS (required for Apple, recommended for all)
- Test from incognito/private window
- Verify email addresses are captured correctly
Troubleshooting
Social Buttons Not Showing
Check:AUTH_USE_SOCIAL_AUTHis enabled- Both Client ID and Secret are filled in
- Cache cleared:
php artisan config:clear - View the login page source - buttons should be in HTML
”Redirect URI Mismatch” Error
Solution:- Ensure callback URL in provider settings matches exactly
- Format:
https://yourapp.com/auth/callback/provider-name - Check for trailing slashes
- Verify HTTP vs HTTPS
”Invalid Client” Error
Solution:- Double-check Client ID and Secret
- Ensure no extra spaces when copying
- Regenerate secret if needed
- Verify app is in correct mode (test vs live)
Apple Sign In Not Working
Common Issues:- Not using HTTPS
- Private key not formatted correctly (should be plain text from .p8 file)
- Service ID doesn’t match Client ID
- Domain not verified in Apple Developer portal
User Email Not Captured
Solution:- Check provider permissions include email
- Some providers (Apple) make email optional - request explicitly
- Verify OAuth scopes in your provider configuration
Security Best Practices
Protecting Secrets
- Never commit Client Secrets to version control
- Use different credentials for dev/staging/production
- Rotate secrets regularly (every 6-12 months)
- Revoke immediately if compromised
User Privacy
- Request minimum permissions - Only what you need
- Display privacy policy - Link on login page
- Allow unlinking - Let users disconnect providers
- Secure tokens - Social tokens are encrypted in database
Access Control
- Verify email domains - Restrict to certain domains if needed
- Check provider responses - Validate data before trusting
- Rate limiting - Prevent OAuth abuse
- Monitor - Watch for suspicious OAuth activity
Advanced Configuration
Email Verification with Social Auth
By default, social auth users are considered verified (provider verified their email). To require additional verification: Location:app/Http/Controllers/SocialAuthController.php
Multiple Accounts Per User
Users can link multiple providers to one account. Thesocial_accounts table stores all connections.
Custom OAuth Scopes
To request additional permissions from providers, modify scopes in: Location:config/services.php
Example:
Next Steps
- General Settings - Configure core app settings
- Environment Management - Advanced .env configuration

