# Descope Django App
Descope is a user management and authentication platform.
This plugin integrates Descope with your Django app.
## Quick start
1. 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._
2. Install "django-descope" and add to your INSTALLED_APPS setting like this:
```bash
poetry add django-descope
OR
pip install django-descope
```
```
INSTALLED_APPS = [
...
'django_descope',
]
```
3. Add Descope Middleware **after** the AuthenticationMiddleware and SessionMiddleware
```
MIDDLEWARE = [
...
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
...
'django_descope.middleware.DescopeMiddleware',
]
```
4. Include descope URLconf in your project urls.py like this:
```
path('auth/', include('django_descope.urls')),
```
5. In your site templates, insert the `descope_flow` tag where you want to place your flow
```html
{% 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 %}
```
6. 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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/descope/django-descope",
"name": "django-descope",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0",
"maintainer_email": "",
"keywords": "descope,jwt,authentication,django",
"author": "Descope",
"author_email": "info@descope.com",
"download_url": "https://files.pythonhosted.org/packages/23/b3/47cef94a1c9e2b854f3e8615b8968be44e3c8732ef7e4eb1c5f5eef84db1/django_descope-1.2.0.tar.gz",
"platform": null,
"description": "# Descope Django App\n\nDescope is a user management and authentication platform.\nThis plugin integrates Descope with your Django app.\n\n## Quick start\n\n1. Sign up for Descope and set admin roles\n\n- Get your project id\n- Create two roles in Descope, that will be mapped to Django permissions\n - is_staff\n - is_superuser\n\nMap these roles to any user you would like to make a staff or superuser in your Django app.\n_The names of these roles can be customized in the settings below._\n\n2. Install \"django-descope\" and add to your INSTALLED_APPS setting like this:\n\n```bash\npoetry add django-descope\nOR\npip install django-descope\n```\n\n```\n INSTALLED_APPS = [\n ...\n 'django_descope',\n ]\n```\n\n3. Add Descope Middleware **after** the AuthenticationMiddleware and SessionMiddleware\n\n```\n MIDDLEWARE = [\n ...\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n ...\n 'django_descope.middleware.DescopeMiddleware',\n ]\n```\n\n4. Include descope URLconf in your project urls.py like this:\n\n```\n path('auth/', include('django_descope.urls')),\n```\n\n5. In your site templates, insert the `descope_flow` tag where you want to place your flow\n\n```html\n{% load descope %}\n<!-- load the descope registry -->\n\n{% if user.is_authenticated %}\n<h1>Welcome {{ user.email }} you are logged in!</h1>\n<p><a href=\"{% url 'logout' %}\">Log Out</a></p>\n{% else %} {% descope_flow \"sign-up-or-in\" \"/\" %}\n<!-- provide the descope flow id, and where to redirect after a successful login-->\n{% endif %}\n```\n\n6. Start the development server and visit the newly created view\n\n## Settings\n\nThe following settings are available to configure in your project `settings.py`\n\n#### Required\n\n```\nDESCOPE_PROJECT_ID\n```\n\n#### Optional\n\n```\nDESCOPE_MANAGEMENT_KEY\nDESCOPE_IS_STAFF_ROLE\nDESCOPE_IS_SUPERUSER_ROLE\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Descope plugin for Django",
"version": "1.2.0",
"project_urls": {
"Documentation": "https://docs.descope.com",
"Homepage": "https://github.com/descope/django-descope",
"Repository": "https://github.com/descope/django-descope"
},
"split_keywords": [
"descope",
"jwt",
"authentication",
"django"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f1952bf1c25addae72ac4497c56f569f3ba3bab681662bf8345cc4ea8d663fc4",
"md5": "9d253b2f5478523051073baa40dba206",
"sha256": "a3e199537a46f6826a82867c01c361c1cd4e98f72d3d57ea0bcce7f9ce330c42"
},
"downloads": -1,
"filename": "django_descope-1.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9d253b2f5478523051073baa40dba206",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0",
"size": 10906,
"upload_time": "2023-06-27T11:04:05",
"upload_time_iso_8601": "2023-06-27T11:04:05.155486Z",
"url": "https://files.pythonhosted.org/packages/f1/95/2bf1c25addae72ac4497c56f569f3ba3bab681662bf8345cc4ea8d663fc4/django_descope-1.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "23b347cef94a1c9e2b854f3e8615b8968be44e3c8732ef7e4eb1c5f5eef84db1",
"md5": "a670f8776f8d80d5163c2b145e3b23bd",
"sha256": "e9754917421e0e26238668007b56a9766b5185f5892be7ccd05a7f87f9d962e1"
},
"downloads": -1,
"filename": "django_descope-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "a670f8776f8d80d5163c2b145e3b23bd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0",
"size": 6991,
"upload_time": "2023-06-27T11:04:06",
"upload_time_iso_8601": "2023-06-27T11:04:06.736493Z",
"url": "https://files.pythonhosted.org/packages/23/b3/47cef94a1c9e2b854f3e8615b8968be44e3c8732ef7e4eb1c5f5eef84db1/django_descope-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-27 11:04:06",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "descope",
"github_project": "django-descope",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "django-descope"
}