{"id":18896469,"url":"https://github.com/descope/django-descope","last_synced_at":"2025-04-09T14:06:40.429Z","repository":{"id":60946782,"uuid":"523711234","full_name":"descope/django-descope","owner":"descope","description":"Descope plugin for Django framework","archived":false,"fork":false,"pushed_at":"2025-04-06T22:24:49.000Z","size":756,"stargazers_count":28,"open_issues_count":1,"forks_count":6,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-06T23:25:16.736Z","etag":null,"topics":["app","authentication","descope","django","plugin","python","sdk"],"latest_commit_sha":null,"homepage":"https://docs.descope.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/descope.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-11T12:16:09.000Z","updated_at":"2025-04-02T12:03:49.000Z","dependencies_parsed_at":"2023-10-15T05:23:59.921Z","dependency_job_id":"a364ee07-7038-4b43-b4f6-dda546c68b47","html_url":"https://github.com/descope/django-descope","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/descope%2Fdjango-descope","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/descope%2Fdjango-descope/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/descope%2Fdjango-descope/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/descope%2Fdjango-descope/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/descope","download_url":"https://codeload.github.com/descope/django-descope/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054227,"owners_count":21039952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","authentication","descope","django","plugin","python","sdk"],"created_at":"2024-11-08T08:34:04.423Z","updated_at":"2025-04-09T14:06:40.397Z","avatar_url":"https://github.com/descope.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 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\u003c!-- load the descope registry --\u003e\n\n{% if user.is_authenticated %}\n\u003ch1\u003eWelcome {{ user.email }} you are logged in!\u003c/h1\u003e\n\u003cp\u003e\u003ca href=\"{% url 'logout' %}\"\u003eLog Out\u003c/a\u003e\u003c/p\u003e\n{% else %} {% descope_flow \"sign-up-or-in\" \"/\" %}\n\u003c!-- provide the descope flow id, and where to redirect after a successful login--\u003e\n{% endif %}\n```\n\n6. Start the development server and visit the newly created view\n\n## Testing\n\nSee [test_admin.py](example_app/test_admin.py) for a rudimentary example of\nhow to utilize [Descope Test Users](https://docs.descope.com/manage/testusers/)\nwhen testing your application with authenticated users.\nYou can use the helper [`django_descope.authentication.add_tokens_to_request`](django_descope/authentication.py) to add the tokens to the django session\n\n\u003e [!IMPORTANT]\n\u003e Remember you must create the relevant roles in [Descope Console](https://app.descope.com)\n\u003e so you can utilize them in your testing.\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdescope%2Fdjango-descope","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdescope%2Fdjango-descope","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdescope%2Fdjango-descope/lists"}