{"id":18930029,"url":"https://github.com/labd/django-cognito-jwt","last_synced_at":"2025-04-13T00:49:26.137Z","repository":{"id":38807919,"uuid":"118112098","full_name":"labd/django-cognito-jwt","owner":"labd","description":"An Authentication backend for Django Rest Framework for AWS Cognito JWT tokens","archived":false,"fork":false,"pushed_at":"2024-07-03T16:46:45.000Z","size":61,"stargazers_count":181,"open_issues_count":18,"forks_count":58,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-13T00:49:21.759Z","etag":null,"topics":["aws","cognito"],"latest_commit_sha":null,"homepage":"","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/labd.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES","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":"2018-01-19T10:32:25.000Z","updated_at":"2025-04-06T20:06:14.000Z","dependencies_parsed_at":"2024-06-18T21:11:51.573Z","dependency_job_id":"1e8e832b-1a7f-4904-ad74-16f0623880b8","html_url":"https://github.com/labd/django-cognito-jwt","commit_stats":{"total_commits":35,"total_committers":9,"mean_commits":3.888888888888889,"dds":0.6285714285714286,"last_synced_commit":"9d7ca0b685c147e31119b50061473ba1a4eb4ef2"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-cognito-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-cognito-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-cognito-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labd%2Fdjango-cognito-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labd","download_url":"https://codeload.github.com/labd/django-cognito-jwt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650436,"owners_count":21139672,"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":["aws","cognito"],"created_at":"2024-11-08T11:36:16.587Z","updated_at":"2025-04-13T00:49:26.116Z","avatar_url":"https://github.com/labd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":".. start-no-pypi\n.. image:: https://github.com/labd/django-cognito-jwt/workflows/Python%20Tests/badge.svg\n    :target: https://github.com/labd/django-cognito-jwt/workflows/Python%20Tests/\n\n.. image:: http://codecov.io/github/LabD/django-cognito-jwt/coverage.svg?branch=master\n    :target: http://codecov.io/github/LabD/django-cognito-jwt?branch=master\n\n.. image:: https://img.shields.io/pypi/v/django-cognito-jwt.svg\n    :target: https://pypi.python.org/pypi/django-cognito-jwt/\n\n.. image:: https://readthedocs.org/projects/django-cognito-jwt/badge/?version=latest\n    :target: https://django-cognito-jwt.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n.. end-no-pypi\n\n\nDjango Cognito JWT\n==================\n\nAn Authentication backend for Django Rest Framework for AWS Cognito JWT tokens\n\n\nInstallation\n============\n\n.. code-block:: shell\n\n   pip install django-cognito-jwt\n\nUsage\n=====\n\nAdd the following lines to your Django ``settings.py`` file:\n\n.. code-block:: python\n\n    COGNITO_AWS_REGION = '\u003caws region\u003e' # 'eu-central-1'\n    COGNITO_USER_POOL = '\u003cuser pool\u003e'   # 'eu-central-1_xYzaq'\n    COGNITO_AUDIENCE = '\u003cclient id\u003e'\n\n(Optional) If you want to cache the Cognito public keys between requests you can\nenable the ``COGNITO_PUBLIC_KEYS_CACHING_ENABLED`` setting (it only works if you\nhave the Django ``CACHES`` setup to anything other than the dummy backend).\n\n.. code-block:: python\n\n    COGNITO_PUBLIC_KEYS_CACHING_ENABLED = True\n    COGNITO_PUBLIC_KEYS_CACHING_TIMEOUT = 60*60*24  # 24h caching, default is 300s\n\nAlso update the rest framework settings to use the correct authentication backend:\n\n.. code-block:: python\n\n    REST_FRAMEWORK = {\n        'DEFAULT_AUTHENTICATION_CLASSES': [\n            ...\n            'django_cognito_jwt.JSONWebTokenAuthentication',\n            ...\n        ],\n        ...\n     }\n\n\n\nBe sure you are passing the ID Token JWT from Cognito as the authentication header.\nUsing the Access Token will work for authentication only but we're unable to use the `get_or_create_for_cognito` method with the Access Token.\n\n\n(Optional) If you want to use a different user model then the default DJANGO_USER_MODEL\nyou can use the ``COGNITO_USER_MODEL`` setting.\n\n.. code-block:: python\n\n\tCOGNITO_USER_MODEL = \"myproject.AppUser\"\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fdjango-cognito-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabd%2Fdjango-cognito-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabd%2Fdjango-cognito-jwt/lists"}