<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.10",
"maintainer_email": null,
"keywords": "github, django, sso",
"author": "Chris Maillefaud",
"author_email": "chrismaille@users.noreply.github.com",
"download_url": "https://files.pythonhosted.org/packages/18/f0/8ed899eaa0fa57f675da89631422957628eaecde628e895e167a81ccd779/django_github_sso-2.1.1.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\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Easily add GitHub Authentication to your Django Projects",
"version": "2.1.1",
"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": "9c9b9801e38b7c4ab8e077c5cc6daa7aed9ccf7d213e2afac0fbd1395a3752a1",
"md5": "f42cd6ba49061acfed47eb77352a402e",
"sha256": "74e649e13f6609f0a27a39e0c96cad0832983de22be986a5ba5ce30a4b27987b"
},
"downloads": -1,
"filename": "django_github_sso-2.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f42cd6ba49061acfed47eb77352a402e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 22784,
"upload_time": "2024-04-09T19:48:11",
"upload_time_iso_8601": "2024-04-09T19:48:11.262044Z",
"url": "https://files.pythonhosted.org/packages/9c/9b/9801e38b7c4ab8e077c5cc6daa7aed9ccf7d213e2afac0fbd1395a3752a1/django_github_sso-2.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "18f08ed899eaa0fa57f675da89631422957628eaecde628e895e167a81ccd779",
"md5": "86fc4070416bd1d14df7c585f1a2714c",
"sha256": "228827093da3dc16f11b33de0dc129e7cef666e4998580d642c71da1e30a79e2"
},
"downloads": -1,
"filename": "django_github_sso-2.1.1.tar.gz",
"has_sig": false,
"md5_digest": "86fc4070416bd1d14df7c585f1a2714c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 17075,
"upload_time": "2024-04-09T19:48:12",
"upload_time_iso_8601": "2024-04-09T19:48:12.978317Z",
"url": "https://files.pythonhosted.org/packages/18/f0/8ed899eaa0fa57f675da89631422957628eaecde628e895e167a81ccd779/django_github_sso-2.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-09 19:48:12",
"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"
}