Easily integrate Google Authentication into your Django projects
This library simplifies the process of authenticating users with Google in Django projects. It adds a customizable "Login with Google" button to your Django Admin login page with minimal configuration.
- Simplicity: Adds Google authentication with minimal setup and no template modifications
- Admin Integration: Seamlessly integrates with the Django Admin interface
- Customizable: Works with popular Django Admin skins like Grappelli, Jazzmin, and more
- Modern: Uses the latest Google authentication libraries
- Secure: Follows OAuth 2.0 best practices for authentication
$ pip install django-google-ssoCompatibility
- Python 3.11, 3.12, 3.13
- Django 4.2, 5.0, 5.1, 5.2
Older python/django versions are not supported.
- Add to your
settings.py:
# settings.py
INSTALLED_APPS = [
# other django apps
"django.contrib.messages", # Required for auth messages
"django_google_sso", # Add django_google_sso
]
# Google OAuth2 credentials
GOOGLE_SSO_CLIENT_ID = "your client id here"
GOOGLE_SSO_PROJECT_ID = "your project id here"
GOOGLE_SSO_CLIENT_SECRET = "your client secret here"
# Auto-create users from these domains
GOOGLE_SSO_ALLOWABLE_DOMAINS = ["example.com"]-
Add the callback URL in Google Console under "Authorized Redirect URIs":
- For local development:
http://localhost:8000/google_sso/callback/ - For production:
https://your-domain.com/google_sso/callback/
- For local development:
-
Add to your
urls.py:
# urls.py
from django.urls import include, path
urlpatterns = [
# other urlpatterns...
path(
"google_sso/", include("django_google_sso.urls", namespace="django_google_sso")
),
]- Run migrations:
$ python manage.py migrateThat's it! Start Django and visit http://localhost:8000/admin/login to see the Google SSO button:
A minimal Django project using this library is included in this repository under example_google_app/.
- Read the step-by-step instructions in example_google_app/README.md
- Use it as a reference to configure your own project settings and URLs
For detailed documentation, visit:
- Full Documentation
- Quick Setup
- Google Credentials Setup
- User Management
- Customization
- Troubleshooting
This project is licensed under the terms of the MIT license.

