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
  • 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.3.tar.gz (23.7 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.3-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_google_sso-9.0.3.tar.gz
  • Upload date:
  • Size: 23.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.1 Linux/6.14.0-1017-azure

File hashes

Hashes for django_google_sso-9.0.3.tar.gz
Algorithm Hash digest
SHA256 d79ea32ee9df9fae56390dfbedcaadf494206e7a9b49b55a7efaacdf314ab48d
MD5 1526e2e2ea0f91d544eaeb0ca66a4e84
BLAKE2b-256 c99486df56f14ee5a1bc6f1f70b8c37c9287b72d4f35c99283b9c8a3736d7e34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_google_sso-9.0.3-py3-none-any.whl
  • Upload date:
  • Size: 33.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.2 CPython/3.12.1 Linux/6.14.0-1017-azure

File hashes

Hashes for django_google_sso-9.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 79dfc70536353ede12f37b6336951870d786b001fe4bd8daefcb180a8650ee65
MD5 fd3f06af56bee8671c141110584c8dbc
BLAKE2b-256 57d883b5f453daa9dd191ad635eed9f6a6c9604786e9337b65f22d06282d67b5

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