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

Welcome to Django Google SSO

This library aims to simplify the process of authenticating users with Google in Django Admin pages, inspired by libraries like django_microsoft_auth and django-admin-sso


Documentation


Install

$ pip install django-google-sso

Configure

  1. Add the following to your settings.py INSTALLED_APPS:
# settings.py

INSTALLED_APPS = [
    # other django apps
    "django.contrib.messages",  # Need for Auth messages
    "django_google_sso",  # Add django_google_sso
]
  1. In Google Console at Api -> Credentials, retrieve your Project Credentials and add them in your settings.py:
# settings.py

GOOGLE_SSO_CLIENT_ID = "your client id here"
GOOGLE_SSO_PROJECT_ID = "your project id here"
GOOGLE_SSO_CLIENT_SECRET = "your client secret here"
  1. Add the callback uri http://localhost:8000/google_sso/callback/ in your Google Console, on the "Authorized Redirect URL".

  2. Let Django Google SSO auto create users for allowable domains:

# settings.py

GOOGLE_SSO_ALLOWABLE_DOMAINS = ["example.com"]
  1. In urls.py please add the Django-Google-SSO views:
# urls.py

from django.urls import include, path

urlpatterns = [
    # other urlpatterns...
    path(
        "google_sso/", include("django_google_sso.urls", namespace="django_google_sso")
    ),
]
  1. And run migrations:
$ python manage.py migrate

That's it. Start django on port 8000 and open your browser in http://localhost:8000/admin/login and you should see the Google SSO button.


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-8.0.0.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

django_google_sso-8.0.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_google_sso-8.0.0.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for django_google_sso-8.0.0.tar.gz
Algorithm Hash digest
SHA256 26423a39d907546f91d3b06acbce698d8f80e1675c75d62cdf9d4ee2ec27c89c
MD5 a96518b1457013bfdabf3c3c6126c649
BLAKE2b-256 78113caca79adc78dd0cd4c5e10e9dbcb0f72ea0a4a704cf07a45439066a5f04

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_google_sso-8.0.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for django_google_sso-8.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f50132b6fb1ee09acc6161b34f4ca6f9655294b16299296cc1cdcaa2cff8b09a
MD5 84662644e3602678052b3e7484d6145f
BLAKE2b-256 e3e3d1e103ab160c385ae3fff96be1f4791f084c914a36d6233a42c9f3cfd4d8

See more details on using hashes here.

Supported by

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