Overview
This document provides step-by-step instructions to configure Google OAuth social login for CasaHub application.
Prerequisites
- Access to CasaHub Frappe site (local or production)
- Administrator credentials
- Google Cloud Console access
OAuth Credentials
Google Cloud Project Details
- Project ID:
casahub-476121 - Client ID:
553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.com - Client Secret:
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 - Console URL: https://console.cloud.google.com/auth/clients?project=casahub-476121
Setup Instructions
Step 1: Update Google Cloud Console Settings
-
Navigate to OAuth Client Settings
- Go to: https://console.cloud.google.com/auth/clients?project=casahub-476121
- Click on the OAuth 2.0 Client ID:
553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.com
-
Update Authorized JavaScript Origins
Add the following origins based on your environment:
For Production (Frappe Cloud):
https://casahub.jh.frappe.cloudFor Local Development:
http://casahub.local http://localhost:8000 -
Update Authorized Redirect URIs
Add the following redirect URIs:
For Production (Frappe Cloud):
https://casahub.jh.frappe.cloud/api/method/frappe.integrations.oauth2_logins.login_via_google https://casahub.jh.frappe.cloud/api/method/frappe.integrations.oauth2_logins.custom/googleFor Local Development:
http://casahub.local/api/method/frappe.integrations.oauth2_logins.login_via_google http://casahub.local/api/method/frappe.integrations.oauth2_logins.custom/google -
Save Changes
- Click Save at the bottom of the page
Step 2: Configure Frappe Site
Option A: Via Bench Command (Recommended)
For Production Site:
cd /home/amirah-michelle/frappe-bench
# Set Google OAuth credentials
bench --site casahub.jh.frappe.cloud set-config google_client_id "553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.com"
bench --site casahub.jh.frappe.cloud set-config google_client_secret "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"
# Restart the site
bench --site casahub.jh.frappe.cloud restart
For Local Development Site:
cd /home/amirah-michelle/frappe-bench
# Set Google OAuth credentials
bench --site casahub.local set-config google_client_id "553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.com"
bench --site casahub.local set-config google_client_secret "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"
# Restart the site
bench restart
Option B: Manual Configuration
Edit site_config.json:
# For local site
nano sites/casahub.local/site_config.json
# For production site
nano sites/casahub.jh.frappe.cloud/site_config.json
Add the following to the JSON file:
{
"google_client_id": "553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.com",
"google_client_secret": "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"
}
Restart the site:
bench restart
Step 3: Create Social Login Key in Frappe
-
Login as Administrator
- Go to your Frappe site
- Login with administrator credentials
-
Navigate to Social Login Key
- Press
Ctrl+K(orCmd+Kon Mac) to open the search bar - Type "Social Login Key" and press Enter
- Or directly visit:
http://casahub.local/app/social-login-key
- Press
-
Create New Social Login Key
- Click "New" button
- Fill in the following details:
Field Value Social Login Provider Google Client ID 553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.comClient Secret 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Enable Social Login ✅ Checked Redirect URI See below based on environment Redirect URI for Production:
https://casahub.jh.frappe.cloud/api/method/frappe.integrations.oauth2_logins.custom/googleRedirect URI for Local:
http://casahub.local/api/method/frappe.integrations.oauth2_logins.custom/google -
Save the Document
- Click Save
Step 4: Enable Social Login in System Settings
-
Navigate to System Settings
- Search for "System Settings" in the awesome bar
- Or visit:
http://casahub.local/app/system-settings
-
Enable Social Login
- Scroll to Login Settings section
- Check ✅ Enable Social Login
- Click Save
Testing
Test Google OAuth Login
- Logout from your current session
- Navigate to the login page:
- Local:
http://casahub.local/micasa/login - Production:
https://casahub.jh.frappe.cloud/micasa/login
- Local:
- Click "Continue with Google" button
- Select your Google account
- Authorize CasaHub to access your Google profile
- You should be redirected back and logged in automatically
Expected Behavior
✅ Success:
- User is redirected to Google login
- After authorization, user is redirected back to CasaHub
- User is automatically logged in
- If first-time user, account is created and onboarding flow starts
❌ Common Issues:
| Issue | Solution |
|---|---|
| "Redirect URI mismatch" error | Verify redirect URIs in Google Console match exactly |
| "Invalid client" error | Check client ID and secret are correct |
| Social login button not showing | Verify Social Login Key is enabled and saved |
| CORS errors | Add your domain to Authorized JavaScript Origins |
Verification Checklist
- Google Cloud Console redirect URIs updated
- Google Cloud Console JavaScript origins updated
-
site_config.jsoncontains correct client ID and secret - Social Login Key created in Frappe with correct details
- Social Login Key is enabled (checkbox checked)
- System Settings has "Enable Social Login" checked
- Site restarted after configuration changes
- Test login successful
Security Notes
⚠️ Important Security Considerations:
-
Never commit credentials to version control
- Add
site_config.jsonto.gitignore - Use environment variables for production
- Add
-
Rotate secrets regularly
- Change client secret periodically
- Update in both Google Console and Frappe
-
Use HTTPS in production
- Never use HTTP for OAuth in production
- Ensure SSL certificate is valid
-
Restrict OAuth scopes
- Only request necessary Google permissions
- Review OAuth consent screen settings
Environment-Specific Configuration
Local Development (casahub.local)
# Site config
bench --site casahub.local set-config google_client_id "553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.com"
bench --site casahub.local set-config google_client_secret "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"
# Redirect URI
http://casahub.local/api/method/frappe.integrations.oauth2_logins.custom/google
# JavaScript Origin
http://casahub.local
Production (Frappe Cloud)
# Site config
bench --site casahub.jh.frappe.cloud set-config google_client_id "553782146847-4behr365rs36qhc5rd7p9vs1n854dagq.apps.googleusercontent.com"
bench --site casahub.jh.frappe.cloud set-config google_client_secret "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"
# Redirect URI
https://casahub.jh.frappe.cloud/api/method/frappe.integrations.oauth2_logins.custom/google
# JavaScript Origin
https://casahub.jh.frappe.cloud
Troubleshooting
Debug Commands
Check site configuration:
cat sites/casahub.local/site_config.json | grep google
Verify Social Login Keys:
bench --site casahub.local console
In the console:
import frappe
frappe.get_all('Social Login Key',
filters={'enable_social_login': 1},
fields=['name', 'social_login_provider', 'client_id'])
Check error logs:
tail -f sites/casahub.local/logs/web.error.log
Common Error Messages
"Error 400: redirect_uri_mismatch"
- Cause: Redirect URI in Google Console doesn't match the one Frappe is using
- Fix: Copy the exact redirect URI from the error message and add it to Google Console
"Error 401: invalid_client"
- Cause: Client ID or Client Secret is incorrect
- Fix: Double-check credentials in
site_config.jsonand Social Login Key
"Social login is disabled"
- Cause: Social Login Key is not enabled or System Settings doesn't have social login enabled
- Fix: Enable in both Social Login Key document and System Settings
Additional Resources
- Google Cloud Console: https://console.cloud.google.com/auth/clients?project=casahub-476121
- Frappe Documentation: https://frappeframework.com/docs/user/en/guides/integration/oauth
- OAuth 2.0 Playground: https://developers.google.com/oauthplayground/
Support
For issues or questions:
- Check Frappe error logs:
sites/casahub.local/logs/ - Review Google Cloud Console audit logs
- Verify all configuration steps completed
- Test with a different Google account
Last Updated: 2025-11-29
Version: 1.0
Maintainer: CasaHub Development Team