Skip to main content

Easily add Google Authentication to your Django Projects

Project description

Django Google SSO

Easily integrate Google Authentication into your Django projects

PyPI Build PyPI - Python Version PyPI - Django Version License

Welcome to Django Google SSO

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.

Why use Django Google SSO?

  • 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

Quick Start

Installation

$ pip install django-google-sso

Compatibility

  • Python 3.11, 3.12, 3.13
  • Django 4.2, 5.0, 5.1, 5.2

Older python/django versions are not supported.

Configuration

  1. 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"]
  1. 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/
  2. 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")
    ),
]
  1. Run migrations:
$ python manage.py migrate

That's it! Start Django and visit http://localhost:8000/admin/login to see the Google SSO button:

Example project

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

Documentation

For detailed documentation, visit:

License

This project is licensed under the terms of the MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_google_sso-9.0.2.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_google_sso-9.0.2-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

Details for the file django_google_sso-9.0.2.tar.gz.

File metadata

  • Download URL: django_google_sso-9.0.2.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for django_google_sso-9.0.2.tar.gz
Algorithm Hash digest
SHA256 6696bf8fadde396b1aff01b69588fb354a53e442984af8fc2e6fb3b75dc45cf5
MD5 8cf566c2aba7478c9eb49c6c142d156a
BLAKE2b-256 905538a0df6e4d8e7ae3d0227c13a70457a7a688206ccfde8a3d5d46d2aa3b39

See more details on using hashes here.

File details

Details for the file django_google_sso-9.0.2-py3-none-any.whl.

File metadata

  • Download URL: django_google_sso-9.0.2-py3-none-any.whl
  • Upload date:
  • Size: 32.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.0 CPython/3.12.1 Linux/6.11.0-1018-azure

File hashes

Hashes for django_google_sso-9.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd16c1ce4e715149a74ceb1e6252b75f36bd7a1d9592371dd375dbc47610cd5d
MD5 0ab637c7b1b4ba7bcc110c3eafeaaa56
BLAKE2b-256 878152cd7c8eba7235ac1fe97b53761ea0cfd27d285483620b53c206be852556

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page