<p align="center">
<img src="docs/images/django-github-sso.png" alt="Django GitHub SSO"/>
</p>
<p align="center">
<em>Easily integrate GitHub Authentication into your Django projects</em>
</p>
<p align="center">
<a href="https://pypi.org/project/django-github-sso/" target="_blank">
<img alt="PyPI" src="https://img.shields.io/pypi/v/django-github-sso"/></a>
<a href="https://github.com/megalus/django-github-sso/actions" target="_blank">
<img alt="Build" src="https://github.com/megalus/django-github-sso/workflows/tests/badge.svg"/>
</a>
<a href="https://www.python.org" target="_blank">
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/django-github-sso"/>
</a>
<a href="https://www.djangoproject.com/" target="_blank">
<img alt="PyPI - Django Version" src="https://img.shields.io/pypi/djversions/django-github-sso"/>
</a>
</p>
## 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](https://github.com/matthiask/django-admin-sso/)
---
### Documentation
* Docs: https://megalus.github.io/django-github-sso/
---
### Install
```shell
$ pip install django-github-sso
```
### Configure
1. Add the following to your `settings.py` `INSTALLED_APPS`:
```python
# settings.py
INSTALLED_APPS = [
# other django apps
"django.contrib.messages", # Need for Auth messages
"django_github_sso", # Add django_github_sso
]
```
2. 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`.
3. On the same page, add the address `http://localhost:8000/github_sso/callback/` on the "Authorization callback URL" field.
4. Add both credentials in your `settings.py`:
```python
# settings.py
GITHUB_SSO_CLIENT_ID = "your Client ID here"
GITHUB_SSO_CLIENT_SECRET = "your Client Secret here"
```
5. Let Django GitHub SSO auto create users which have access to your repositories:
```python
# settings.py
GITHUB_SSO_NEEDED_REPOS = ["example/example-repo"] # user needs to be a member of all repos listed
```
6. In `urls.py` please add the **Django-Github-SSO** views:
```python
# urls.py
from django.urls import include, path
urlpatterns = [
# other urlpatterns...
path(
"github_sso/", include("django_github_sso.urls", namespace="django_github_sso")
),
]
```
7. And run migrations:
```shell
$ 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.
<p align="center">
<img src="docs/images/django_login_with_github_light.png"/>
</p>
---
## License
This project is licensed under the terms of the MIT license.
Raw data
{
"_id": null,
"home_page": "https://github.com/megalus/django-github-sso",
"name": "django-github-sso",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.11",
"maintainer_email": null,
"keywords": "github, django, sso",
"author": "Chris Maillefaud",
"author_email": "chrismaille@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/56/ea/8901c413309d0db015e97a3324dacaeb522ad39f7ebb3b9b9ffe863ccc26/django_github_sso-4.0.0.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img src=\"docs/images/django-github-sso.png\" alt=\"Django GitHub SSO\"/>\n</p>\n<p align=\"center\">\n<em>Easily integrate GitHub Authentication into your Django projects</em>\n</p>\n\n<p align=\"center\">\n<a href=\"https://pypi.org/project/django-github-sso/\" target=\"_blank\">\n<img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/django-github-sso\"/></a>\n<a href=\"https://github.com/megalus/django-github-sso/actions\" target=\"_blank\">\n<img alt=\"Build\" src=\"https://github.com/megalus/django-github-sso/workflows/tests/badge.svg\"/>\n</a>\n<a href=\"https://www.python.org\" target=\"_blank\">\n<img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/django-github-sso\"/>\n</a>\n<a href=\"https://www.djangoproject.com/\" target=\"_blank\">\n<img alt=\"PyPI - Django Version\" src=\"https://img.shields.io/pypi/djversions/django-github-sso\"/>\n</a>\n</p>\n\n## Welcome to Django GitHub SSO\n\nThis library aims to simplify the process of authenticating users with GitHub in Django Admin pages,\ninspired by libraries like [django-admin-sso](https://github.com/matthiask/django-admin-sso/)\n\n---\n\n### Documentation\n\n* Docs: https://megalus.github.io/django-github-sso/\n\n---\n\n### Install\n\n```shell\n$ pip install django-github-sso\n```\n\n### Configure\n\n1. Add the following to your `settings.py` `INSTALLED_APPS`:\n\n```python\n# settings.py\n\nINSTALLED_APPS = [\n # other django apps\n \"django.contrib.messages\", # Need for Auth messages\n \"django_github_sso\", # Add django_github_sso\n]\n```\n\n2. 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`.\n\n3. On the same page, add the address `http://localhost:8000/github_sso/callback/` on the \"Authorization callback URL\" field.\n\n4. Add both credentials in your `settings.py`:\n\n```python\n# settings.py\n\nGITHUB_SSO_CLIENT_ID = \"your Client ID here\"\nGITHUB_SSO_CLIENT_SECRET = \"your Client Secret here\"\n```\n\n5. Let Django GitHub SSO auto create users which have access to your repositories:\n\n```python\n# settings.py\n\nGITHUB_SSO_NEEDED_REPOS = [\"example/example-repo\"] # user needs to be a member of all repos listed\n```\n\n6. In `urls.py` please add the **Django-Github-SSO** views:\n\n```python\n# urls.py\n\nfrom django.urls import include, path\n\nurlpatterns = [\n # other urlpatterns...\n path(\n \"github_sso/\", include(\"django_github_sso.urls\", namespace=\"django_github_sso\")\n ),\n]\n```\n\n7. And run migrations:\n\n```shell\n$ python manage.py migrate\n```\n\nThat's it. Start django on port 8000 and open your browser in `http://localhost:8000/admin/login` and you should see the\nGitHub SSO button.\n\n<p align=\"center\">\n <img src=\"docs/images/django_login_with_github_light.png\"/>\n</p>\n\n---\n\n## License\n\nThis project is licensed under the terms of the MIT license.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Easily add GitHub Authentication to your Django Projects",
"version": "4.0.0",
"project_urls": {
"Homepage": "https://github.com/megalus/django-github-sso",
"Repository": "https://github.com/megalus/django-github-sso"
},
"split_keywords": [
"github",
" django",
" sso"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f07d8a7283d165cd9ce54958fcb4d11caf3c6a4617b823384f7941688fc42592",
"md5": "9e08cabdd61e4938cfa39c15d37c24f2",
"sha256": "7c2d68206aeda9e826e064a5f2d762a0d29748aa256a70728d4f986eb48248e5"
},
"downloads": -1,
"filename": "django_github_sso-4.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9e08cabdd61e4938cfa39c15d37c24f2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.11",
"size": 24310,
"upload_time": "2024-10-09T15:55:09",
"upload_time_iso_8601": "2024-10-09T15:55:09.281371Z",
"url": "https://files.pythonhosted.org/packages/f0/7d/8a7283d165cd9ce54958fcb4d11caf3c6a4617b823384f7941688fc42592/django_github_sso-4.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "56ea8901c413309d0db015e97a3324dacaeb522ad39f7ebb3b9b9ffe863ccc26",
"md5": "025cae35aa0ee319d2d8f83c58ce85a4",
"sha256": "3fbfe6be03faff7634c47f466c1131d505d7354236643b8416efc9a22d6d7d6c"
},
"downloads": -1,
"filename": "django_github_sso-4.0.0.tar.gz",
"has_sig": false,
"md5_digest": "025cae35aa0ee319d2d8f83c58ce85a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.11",
"size": 18238,
"upload_time": "2024-10-09T15:55:10",
"upload_time_iso_8601": "2024-10-09T15:55:10.277885Z",
"url": "https://files.pythonhosted.org/packages/56/ea/8901c413309d0db015e97a3324dacaeb522ad39f7ebb3b9b9ffe863ccc26/django_github_sso-4.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-09 15:55:10",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "megalus",
"github_project": "django-github-sso",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-github-sso"
}