Easily integrate GitHub Authentication into your Django projects
Welcome to Django GitHub SSO
This library simplifies the process of authenticating users with GitHub in Django projects. It adds a "Login with GitHub" button to your Django admin login page, allowing users to authenticate using their GitHub accounts.
Unlike more complex solutions like django-allauth, Django GitHub SSO focuses on simplicity and ease of use, with minimal configuration required.
Features
- Simple integration with Django admin
- Automatic user creation based on GitHub credentials
- Customizable authentication filters (by domain, organization, or repository)
- Compatible with various Django admin skins
- Support for multiple SSO providers
- Light and dark mode support
Documentation
Full documentation is available at: https://megalus.github.io/django-github-sso/
Requirements
- Python 3.11+
- Django 5.0+
- A GitHub account or organization
Installation
$ pip install django-github-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.
Quick Configuration
- Add the following to your
settings.pyINSTALLED_APPS:
# settings.py
INSTALLED_APPS = [
# other django apps
"django.contrib.messages", # Required 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 newOAuth App. -
On the GitHub OAuth App settings page, add the address
http://localhost:8000/github_sso/callback/(or your domain) in the "Authorization callback URL" field. -
Add your GitHub OAuth credentials to your
settings.py:
# settings.py
GITHUB_SSO_CLIENT_ID = "your Client ID here"
GITHUB_SSO_CLIENT_SECRET = "your Client Secret here"
- Configure user authorization filters (at least one is required):
# settings.py
# Choose one or more of these options:
GITHUB_SSO_ALLOWABLE_DOMAINS = ["example.com"] # Check against user's primary email
GITHUB_SSO_ALLOWABLE_ORGS = ["example"] # User must be a member of all orgs listed
GITHUB_SSO_NEEDED_REPOS = ["example/example-repo"] # User must have access to all repos listed
- Add the Django GitHub SSO URLs to your
urls.py:
# urls.py
from django.urls import include, path
urlpatterns = [
# other urlpatterns...
path(
"github_sso/", include("django_github_sso.urls", namespace="django_github_sso")
),
]
- Run migrations:
$ python manage.py migrate
That's it! Start Django and navigate to http://localhost:8000/admin/login to see the GitHub SSO button:
Environment Variables
For security, it's recommended to use environment variables for your GitHub credentials:
# settings.py
import os
GITHUB_SSO_CLIENT_ID = os.environ.get("GITHUB_SSO_CLIENT_ID")
GITHUB_SSO_CLIENT_SECRET = os.environ.get("GITHUB_SSO_CLIENT_SECRET")
Example project
A minimal Django project using this library is included in this repository under example_github_app/.
- Read the step-by-step instructions in example_github_app/README.md
- Use it as a reference to configure your own project settings and URLs
License
This project is licensed under the terms of the MIT license.
Metadata
Release files for django-github-sso 6.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_github_sso-6.0.0.tar.gz | 235.8 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_github_sso-6.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 269.9 kB
Release files / django_github_sso-6.0.0.tar.gz
| Download URL | django_github_sso-6.0.0.tar.gz |
|---|---|
| Size | 235.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b93a9da1fbc4a68fedd701ed89fa7a95cf0ef84e3c8f58e95dce64eb145ff69
|
|
BLAKE2b-256 checksum How to use checksums |
9a3ed7fb8e800f890442521e0c15df46064c04c4b183b9a45119dcb7aff0b5b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / django_github_sso-6.0.0-py3-none-any.whl
| Download URL | django_github_sso-6.0.0-py3-none-any.whl |
|---|---|
| Size | 34.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
713b4837fb1991607323b325ccbeb7a78d6aefe67c5230e4a8683242abbbe94a
|
|
BLAKE2b-256 checksum How to use checksums |
9bf608f31a656c0e7f416a67dbcc0645863090bc6fd8b0b21b5ea6f0bfb7d198
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logSecurity for django-github-sso 6.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for django_github_sso-6.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.