{"id":22009697,"url":"https://github.com/zitadel/example-python-django-oidc","last_synced_at":"2025-06-24T13:09:26.754Z","repository":{"id":220542578,"uuid":"744604202","full_name":"zitadel/example-python-django-oidc","owner":"zitadel","description":"Example Python Django OIDC Web","archived":false,"fork":false,"pushed_at":"2025-05-19T08:18:11.000Z","size":51,"stargazers_count":10,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-06-01T18:47:35.090Z","etag":null,"topics":["django","examples","mozilla-django-oidc","oidc","python","python3","web"],"latest_commit_sha":null,"homepage":"https://zitadel.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zitadel.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,"zenodo":null}},"created_at":"2024-01-17T16:31:41.000Z","updated_at":"2025-05-19T08:18:15.000Z","dependencies_parsed_at":"2024-02-02T17:25:54.057Z","dependency_job_id":"c78ef6c1-fc94-4f7f-ae54-9b49b2cb417f","html_url":"https://github.com/zitadel/example-python-django-oidc","commit_stats":null,"previous_names":["zitadel/example-python-django-oidc"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/zitadel/example-python-django-oidc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zitadel%2Fexample-python-django-oidc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zitadel%2Fexample-python-django-oidc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zitadel%2Fexample-python-django-oidc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zitadel%2Fexample-python-django-oidc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zitadel","download_url":"https://codeload.github.com/zitadel/example-python-django-oidc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zitadel%2Fexample-python-django-oidc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261682925,"owners_count":23193679,"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":["django","examples","mozilla-django-oidc","oidc","python","python3","web"],"created_at":"2024-11-30T02:10:28.986Z","updated_at":"2025-06-24T13:09:26.715Z","avatar_url":"https://github.com/zitadel.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Example Python Django with external OIDC Provider for a Wep application\n\nThis repository provides a Django example for ZITADEL using OpenID connect (OIDC) authentication instead of the internal authentication mechanism.\nThis example is provided as companion to our [guide](https://zitadel.com/docs/examples/login/django),\nwhich should produce this application when followed.\n\n## Base\n\nThe used base is the \"Writing your first Django app\" from the Django documentation under [https://docs.djangoproject.com/en/5.0/intro/](https://docs.djangoproject.com/en/5.0/intro/), which has documented additional parts in to use [mozilla-django-oidc](https://github.com/mozilla/mozilla-django-oidc) to integrate ZITADEL as AuthenticationBackend.\n\n## Features\n\n- OIDC Code flow with User Info call after authentication.\n- Fully integrated with Django authentication\n- User Role mapping to standard user types in Django (superuser/staff/user)\n- Persistent user data using local sqlite file. See `DATABASE_URL` in [.env](.env).\n- Public page at `/polls`\n- Authenticated `/polls/\u003cid\u003e/` page for all users.\n- Authenticated `/polls/\u003cid\u003e/results/` page for staff role users.\n- Authenticated `/admin/` pages for admin role users.\n\n## Getting started\n\nIf you want to run this example directly you can fork and clone it to your system.\nBe sure to [configure ZITADEL](https://zitadel.com/docs/examples/login/django#zitadel-setup) to accept requests from this app.\n\n### Prerequisites\n\nYou have to install Python as described in [their documentation](https://wiki.python.org/moin/BeginnersGuide/Download) and then download all dependencies through:\n\n```bash\npython -m pip install -r requirements.txt\n```\n\nAlternatively if you have a system with Docker and an IDE capable of running [Development Container](https://containers.dev/),\ndefinitions are provided with a complete Python environment, configuration and tools required for Django development.\nUse your IDE to build and launch the development environment or use GitHub code spaces from your browser.\n\n### Django\n\nAfter setting up your system and repository, create the sqlite-database.\n\n```bash\npython manage.py migrate\n```\n\nFill in the `.env`-file in your directory with the following information:\n\n```bash\nZITADEL_PROJECT = \"ID of the project you created the application in ZITADEL\" \nOIDC_RP_CLIENT_ID = \"ClientID provided by the created application in ZITADEL\"\nOIDC_RP_CLIENT_SECRET = \"ClientSecret provided by the created application in ZITADEL\"\nOIDC_OP_BASE_URL = \"Base URL for your ZITADEL instance\"\n```\n\nI should look something like this:\n\n```bash\nZITADEL_PROJECT = \"249703732336418456\" \nOIDC_RP_CLIENT_ID = \"249703852243222580@python\"\nOIDC_RP_CLIENT_SECRET = \"Zy3OOHaMBTj2sfamW87Vak5BeQ3nEpOf7suPKTnJKaScMh0lPJqUeDOZmgL3bdGa\"\nOIDC_OP_BASE_URL = \"https://example.zitadel.cloud\"\n```\n\nAnd run the server:\n\n```bash\npython manage.py runserver\n```\n\nVisit [http://localhost:8000/](http://localhost:8000/), where you see all available endpoints.\n\nYou can create Questions and the availabe Choices, where users can vote on.\nAfter you can go to [http://localhost:8000/polls/](http://localhost:8000/polls/) and vote on different Questions.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzitadel%2Fexample-python-django-oidc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzitadel%2Fexample-python-django-oidc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzitadel%2Fexample-python-django-oidc/lists"}