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, including PKCE support

Quick Start

Installation

$ pip install django-google-sso

Compatibility

  • Python 3.11, 3.12, 3.13, 3.14
  • Django 5.0, 5.1, 5.2, 6.0

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-10.0.0.tar.gz (130.6 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-10.0.0-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_google_sso-10.0.0.tar.gz
  • Upload date:
  • Size: 130.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for django_google_sso-10.0.0.tar.gz
Algorithm Hash digest
SHA256 777730876039cfe0c4b29e33374e9e7a84a06d0433c73d7353dd4f88742b546f
MD5 cf627cc66ae2de272588602f3ef1f910
BLAKE2b-256 432797b8231bdf6ef85ec17ed9b89747c31cddb01f775c582e851eaf08ae1719

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_google_sso-10.0.0.tar.gz:

Publisher: publish.yml on megalus/django-google-sso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for django_google_sso-10.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8212f60eeb63da259e4c254f52dfffd139e6e14251a98dc45edf68c7d4a40c8a
MD5 f2a2931f25dfb70ca759bdc496d503af
BLAKE2b-256 577edfc5400f1f65a523d0f048cae9251b1aff72c4eaf44a0918bfb39ddea6a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_google_sso-10.0.0-py3-none-any.whl:

Publisher: publish.yml on megalus/django-google-sso

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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