Descope plugin for Django
Project description
Descope Django App
Descope is a user management and authentication platform. This plugin integrates Descope with your Django app.
Quick start
- Sign up for Descope and set admin roles
- Get your project id
- Create two roles in Descope, that will be mapped to Django permissions
- is_staff
- is_superuser
Map these roles to any user you would like to make a staff or superuser in your Django app. The names of these roles can be customized in the settings below.
- Install "django-descope" and add to your INSTALLED_APPS setting like this:
poetry add django-descope
OR
pip install django-descope
INSTALLED_APPS = [
...
'django_descope',
]
- Add Descope Middleware after the AuthenticationMiddleware and SessionMiddleware
MIDDLEWARE = [
...
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
...
'django_descope.middleware.DescopeMiddleware',
]
- Include descope URLconf in your project urls.py like this:
path('auth/', include('django_descope.urls')),
- In your site templates, insert the
descope_flow
tag where you want to place your flow
{% load descope %}
<!-- load the descope registry -->
{% if user.is_authenticated %}
<h1>Welcome {{ user.email }} you are logged in!</h1>
<p><a href="{% url 'logout' %}">Log Out</a></p>
{% else %} {% descope_flow "sign-up-or-in" "/" %}
<!-- provide the descope flow id, and where to redirect after a successful login-->
{% endif %}
- Start the development server and visit the newly created view
Settings
The following settings are available to configure in your project settings.py
Required
DESCOPE_PROJECT_ID
Optional
DESCOPE_MANAGEMENT_KEY
DESCOPE_IS_STAFF_ROLE
DESCOPE_IS_SUPERUSER_ROLE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django_descope-1.3.0.tar.gz
(7.0 kB
view hashes)
Built Distribution
Close
Hashes for django_descope-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 519f1741f594aa78622d51349059f6c6466906300453d955d8f03e3d9b990971 |
|
MD5 | 61ee0d5ec5ed87df59208399c22c6918 |
|
BLAKE2b-256 | dd1fca1652da555245ffa2093446fd3a16f21fe8a5f50787c79cf280aa2b2dbc |