Easily add GitHub Authentication to your Django Projects
Project description
Easily integrate GitHub Authentication into your Django projects
Welcome to Django GitHub SSO
This library aims to simplify the process of authenticating users with GitHub in Django Admin pages, inspired by libraries like django-admin-sso
Documentation
Install
$ pip install django-github-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_github_sso", # Add django_github_sso
]
-
Navigate to
https://github.com/organizations/<YOUR ORGANIZATION>/settings/applications
, then select or create a newOrg OAuth App
. From that, retrieve yourClient ID
andClient Secret
. -
On the same page, add the address
http://localhost:8000/github_sso/callback/
on the "Authorization callback URL" field. -
Add both credentials in your
settings.py
:
# settings.py
GITHUB_SSO_CLIENT_ID = "your Client ID here"
GITHUB_SSO_CLIENT_SECRET = "your Client Secret here"
- Let Django GitHub SSO auto create users which have access to your repositories:
# settings.py
GITHUB_SSO_NEEDED_REPOS = ["example/example-repo"] # user needs to be a member of all repos listed
- In
urls.py
please add the Django-Github-SSO views:
# urls.py
from django.urls import include, path
urlpatterns = [
# other urlpatterns...
path(
"github_sso/", include("django_github_sso.urls", namespace="django_github_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
GitHub 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
File details
Details for the file django_github_sso-4.0.0.tar.gz
.
File metadata
- Download URL: django_github_sso-4.0.0.tar.gz
- Upload date:
- Size: 18.2 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fbfe6be03faff7634c47f466c1131d505d7354236643b8416efc9a22d6d7d6c |
|
MD5 | 025cae35aa0ee319d2d8f83c58ce85a4 |
|
BLAKE2b-256 | 56ea8901c413309d0db015e97a3324dacaeb522ad39f7ebb3b9b9ffe863ccc26 |
File details
Details for the file django_github_sso-4.0.0-py3-none-any.whl
.
File metadata
- Download URL: django_github_sso-4.0.0-py3-none-any.whl
- Upload date:
- Size: 24.3 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c2d68206aeda9e826e064a5f2d762a0d29748aa256a70728d4f986eb48248e5 |
|
MD5 | 9e08cabdd61e4938cfa39c15d37c24f2 |
|
BLAKE2b-256 | f07d8a7283d165cd9ce54958fcb4d11caf3c6a4617b823384f7941688fc42592 |