{"id":17834682,"url":"https://github.com/bendog/django_jwt_demo","last_synced_at":"2025-09-01T20:06:43.193Z","repository":{"id":39842947,"uuid":"223536048","full_name":"bendog/django_jwt_demo","owner":"bendog","description":"Django + Django Rest Framework + JWT Authentication Demo","archived":false,"fork":false,"pushed_at":"2022-05-25T02:19:15.000Z","size":41,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-02T12:49:29.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bendog.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-23T05:26:06.000Z","updated_at":"2021-06-03T12:33:21.000Z","dependencies_parsed_at":"2022-09-09T07:01:45.177Z","dependency_job_id":null,"html_url":"https://github.com/bendog/django_jwt_demo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bendog/django_jwt_demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendog%2Fdjango_jwt_demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendog%2Fdjango_jwt_demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendog%2Fdjango_jwt_demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendog%2Fdjango_jwt_demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bendog","download_url":"https://codeload.github.com/bendog/django_jwt_demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bendog%2Fdjango_jwt_demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273183228,"owners_count":25059812,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-27T20:09:34.338Z","updated_at":"2025-09-01T20:06:43.153Z","avatar_url":"https://github.com/bendog.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django JWT Demo\n\n## references\n\nGetting DRF setup  \n\u003chttps://www.django-rest-framework.org/tutorial/quickstart/\u003e\n\nSetting up JWT authentication for Django + DRF  \n\u003chttps://simpleisbetterthancomplex.com/tutorial/2018/12/19/how-to-use-jwt-authentication-with-django-rest-framework.html\u003e\n\n## Install packages\n\n### with pipenv\n\n1. in this directory, run `pipenv install`\n1. activate the environment with `pipenv shell`\n\n### with pip and virtualenv\n\n1. in this directory setup a new virtual environment run `python3 -m venv .venv`\n1. activate that virtual environment `source ./.venv/bin/activate` on mac/linux\n1. install pip packages with `pip install -U -r requirements.txt`\n\n## setup database\n\n    (.venv)$ cd project\n    (.venv)$ python manage.py migrate\n    (.venv)$ python manage.py loaddata data.json\n\n## run dev server\n\n    (.venv)$ python manage.py runserver\n\n\n## Accessing the resources\n\n### authenticating \n\nrun this in your terminal to authenticate\n```\ncurl --request POST \\\n  --url http://127.0.0.1:8000/api/token/ \\\n  --header 'content-type: application/json' \\\n  --data '{\n\t\"username\": \"bendog\",\n\t\"password\": \"meowmeow\"\n}'\n```\n\nyou should get a response like this\n```json\n{\n  \"refresh\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTU3NDU3MTg3MCwianRpIjoiNGRmMzQ1ZDcwZmEyNDRiZTg4MzRkY2ZjMTVkN2FmZjMiLCJ1c2VyX2lkIjoxfQ.VMLqAZL4mqUBgmh3Hqg0NOgm2XyI8D9htjfccM1UO1I\",\n  \"access\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTc0NDg1NzcwLCJqdGkiOiI2ZjcyY2RmYzAxN2E0NDc4ODFiMjdhNWY5NjEyNzMyOCIsInVzZXJfaWQiOjF9.W1Ph-VsaoXeHIJEQmv3Y1zs-_Ja9HHAmlQCiUz4cmfI\"\n}\n```\n\n**Make sure to copy the value of \"access\", you will need this to access all future resources**\n\n### listing users\n\n```\ncurl --request GET \\\n  --url http://127.0.0.1:8000/app/users/ \\\n  --header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTc0NDg1NzcwLCJqdGkiOiI2ZjcyY2RmYzAxN2E0NDc4ODFiMjdhNWY5NjEyNzMyOCIsInVzZXJfaWQiOjF9.W1Ph-VsaoXeHIJEQmv3Y1zs-_Ja9HHAmlQCiUz4cmfI'\n```\n\n### listing profiles\n\n```\ncurl --request GET \\\n  --url http://127.0.0.1:8000/app/profiles/ \\\n  --header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTc0NDg1NzcwLCJqdGkiOiI2ZjcyY2RmYzAxN2E0NDc4ODFiMjdhNWY5NjEyNzMyOCIsInVzZXJfaWQiOjF9.W1Ph-VsaoXeHIJEQmv3Y1zs-_Ja9HHAmlQCiUz4cmfI'\n```\n\n### retrieving a specific url\n\n```\ncurl --request GET \\\n  --url http://127.0.0.1:8000/app/profiles/2/ \\\n  --header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTc0NDg1NzcwLCJqdGkiOiI2ZjcyY2RmYzAxN2E0NDc4ODFiMjdhNWY5NjEyNzMyOCIsInVzZXJfaWQiOjF9.W1Ph-VsaoXeHIJEQmv3Y1zs-_Ja9HHAmlQCiUz4cmfI' \\\n  --header 'content-type: application/json'\n```\n\n### updating a specific profile\n\n```\ncurl --request PATCH \\\n  --url http://127.0.0.1:8000/app/profiles/2/ \\\n  --header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTc0NDg1NzcwLCJqdGkiOiI2ZjcyY2RmYzAxN2E0NDc4ODFiMjdhNWY5NjEyNzMyOCIsInVzZXJfaWQiOjF9.W1Ph-VsaoXeHIJEQmv3Y1zs-_Ja9HHAmlQCiUz4cmfI' \\\n  --header 'content-type: application/json' \\\n  --data '{\n\t\"nick_name\": \"choose goose\"\n}'\n```\n\n### create a new user\n\n```\ncurl --request POST \\\n  --url http://127.0.0.1:8000/app/users/ \\\n  --header 'authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNTc0NDg1NzcwLCJqdGkiOiI2ZjcyY2RmYzAxN2E0NDc4ODFiMjdhNWY5NjEyNzMyOCIsInVzZXJfaWQiOjF9.W1Ph-VsaoXeHIJEQmv3Y1zs-_Ja9HHAmlQCiUz4cmfI' \\\n  --header 'content-type: application/json' \\\n  --data '{\n\t\"username\": \"test3\",\n\t\"password\": \"moomoomoo\",\n\t\"email\": \"cow@nope.com\",\n\t\"first_name\": \"test\",\n\t\"last_name\": \"cow\"\n}'\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendog%2Fdjango_jwt_demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbendog%2Fdjango_jwt_demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbendog%2Fdjango_jwt_demo/lists"}