Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itamco/django2-auth0-auth
Django Auth0 Auth allows you to authenticate through Auth0 in Django 2
https://github.com/itamco/django2-auth0-auth
auth0 django django2
Last synced: about 1 month ago
JSON representation
Django Auth0 Auth allows you to authenticate through Auth0 in Django 2
- Host: GitHub
- URL: https://github.com/itamco/django2-auth0-auth
- Owner: ITAMCO
- License: bsd-3-clause
- Created: 2019-02-25T11:55:11.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-02-25T17:53:13.000Z (almost 6 years ago)
- Last Synced: 2024-12-01T01:51:08.816Z (2 months ago)
- Topics: auth0, django, django2
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Django Auth0 Auth
=================*Django Auth0 Auth* allows you to authenticate through Auth0 in Django 2
Installation
------------Run `pip install django2-auth0-auth`
Add the `Auth0Backend` to your `AUTHENTICATION_BACKENDS` setting:
```python
AUTHENTICATION_BACKENDS = (
...
'auth0_auth.backends.Auth0Backend',
)
```Add the `Auth0Middleware` to your `MIDDLEWARE` setting:
```python
MIDDLEWARE = [
...
'auth0_auth.middleware.Auth0Middleware'
]
```Edit your `urls.py` to include:
```python
from django.views.generic import RedirectView
``````python
urlpatterns = [
...
#Add this BEFORE you include the admin urls, so admin login will redirect to auth0 login
path('admin/login/', RedirectView.as_view(pattern_name='auth0_login', permanent=False, query_string=True)),
#Add the auth0 urls
path('auth0/', include('auth0_auth.urls')),
...
]
```Settings
--------### AUTH0_DOMAIN
Auth0 domain.
### AUTH0_CLIENT_ID
Auth0 client id.
### AUTH0_CLIENT_SECRET
Auth0 client secret.
### AUTH0_SECRET_BASE64_ENCODED
**default:** `False`
Flag if Auth0 client secret is base64 encoded.### AUTH0_SCOPE
**default:** `'openid email'`
OAuth scope parameter.### AUTH0_RESPONSE_TYPE
**default:** `'code'`
OAuth response type parameter.### AUTH0_USER_CREATION
**default:** `True`
Allow creation of new users after successful authentication.Logging
-------
To enable logging add `auth0_auth` to `LOGGING['loggers']` options.```python
LOGGING = {
...,
'loggers': {
...,
'auth0_auth': {
'handlers': ['console'],
'level': 'DEBUG',
}
}
}
```