Skip to main content

Easily add GitHub Authentication to your Django Projects

Project description

Django GitHub SSO

Easily integrate GitHub Authentication into your Django projects

PyPI Build PyPI - Python Version PyPI - Django Version

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

  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_github_sso",  # Add django_github_sso
]
  1. Navigate to https://github.com/organizations/<YOUR ORGANIZATION>/settings/applications, then select or create a new Org OAuth App. From that, retrieve your Client ID and Client Secret.

  2. On the same page, add the address http://localhost:8000/github_sso/callback/ on the "Authorization callback URL" field.

  3. 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"
  1. 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
  1. 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")
    ),
]
  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 GitHub 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_github_sso-4.0.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

django_github_sso-4.0.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

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

Hashes for django_github_sso-4.0.0.tar.gz
Algorithm Hash digest
SHA256 3fbfe6be03faff7634c47f466c1131d505d7354236643b8416efc9a22d6d7d6c
MD5 025cae35aa0ee319d2d8f83c58ce85a4
BLAKE2b-256 56ea8901c413309d0db015e97a3324dacaeb522ad39f7ebb3b9b9ffe863ccc26

See more details on using hashes here.

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

Hashes for django_github_sso-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c2d68206aeda9e826e064a5f2d762a0d29748aa256a70728d4f986eb48248e5
MD5 9e08cabdd61e4938cfa39c15d37c24f2
BLAKE2b-256 f07d8a7283d165cd9ce54958fcb4d11caf3c6a4617b823384f7941688fc42592

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