Easily add Google Authentication to your Django Projects
Project description
Easily integrate Google Authentication into your Django projects
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
- 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
]
- 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"
-
Add the callback uri
http://localhost:8000/google_sso/callback/
in your Google Console, on the "Authorized Redirect URL". -
Let Django Google SSO auto create users for allowable domains:
# settings.py
GOOGLE_SSO_ALLOWABLE_DOMAINS = ["example.com"]
- 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")
),
]
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_google_sso-6.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 901525a0bd74296acdc734295fd81c0fbda2dd86dbf7c6e8074e40a73b3007ab |
|
MD5 | 2e4320afbe0f040138137dd62566b819 |
|
BLAKE2b-256 | ae8b8755a9748c16fb84f925aeb437920acc3a2989059d5bb88f191e589caffb |