{"id":23619033,"url":"https://github.com/crmin/drf-tutorial","last_synced_at":"2026-04-30T03:38:00.855Z","repository":{"id":122850957,"uuid":"158681037","full_name":"crmin/drf-tutorial","owner":"crmin","description":"Django Rest Framework Tutorial + JWT Authentication","archived":false,"fork":false,"pushed_at":"2018-11-23T03:27:14.000Z","size":20,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-20T23:43:44.458Z","etag":null,"topics":["django","django-rest-framework","djangorestframework-jwt","jwt","jwt-authentication","tutorial-code"],"latest_commit_sha":null,"homepage":"","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/crmin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-22T10:19:57.000Z","updated_at":"2020-12-04T11:54:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"c08b1850-322e-4570-9a83-963b36974f93","html_url":"https://github.com/crmin/drf-tutorial","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/crmin/drf-tutorial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crmin%2Fdrf-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crmin%2Fdrf-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crmin%2Fdrf-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crmin%2Fdrf-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crmin","download_url":"https://codeload.github.com/crmin/drf-tutorial/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crmin%2Fdrf-tutorial/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32454147,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T22:27:22.272Z","status":"online","status_checked_at":"2026-04-30T02:00:05.929Z","response_time":57,"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":["django","django-rest-framework","djangorestframework-jwt","jwt","jwt-authentication","tutorial-code"],"created_at":"2024-12-27T19:36:31.178Z","updated_at":"2026-04-30T03:37:55.848Z","avatar_url":"https://github.com/crmin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DRF Tutorial\n\n## Test Environment Setting\n\n### Install pipenv\n\u003e This project using pipenv so, if you want to run, you have to install pipenv before run\n* using pip\n```bash\n$ pip install pipenv\n```\n\n* using homebrew (in mac)\n```bash\n$ brew install pipenv\n```\n\n* using apt (in ubuntu)\n```bash\n$ sudo apt install software-properties-common python-software-properties\n$ sudo add-apt-repository ppa:pypa/ppa\n$ sudo apt update\n$ sudo apt install pipenv\n```\n\n### Install Packages for Production Environment\n```bash\n$ pipenv install\n``` \nThen, pipenv install packages:\n* django\n* djangorestframework\n* pygments\n* djangorestframework-jwt\n\n### Install Packages for Development Environment\n```bash\n$ pipenv install --dev\n``` \nThen, pipenv install packages:\n* [production packages]\n* httpie\n\nIf you want to run examples in README, you have to install packages for dev env.\n\n\n## JWT Authentication\n\n### Obtain JWT Token\n* Request\n```bash\n$ http -f POST http://localhost:8000/auth/ username='username' password='password'\n```\n* Response\n```\nHTTP/1.1 200 OK\nAllow: POST, OPTIONS\nContent-Length: 193\nContent-Type: application/json\nDate: Fri, 23 Nov 2018 02:12:44 GMT\nServer: WSGIServer/0.2 CPython/3.7.0\nVary: Accept\nX-Frame-Options: SAMEORIGIN\n\n{\n    \"token\": \"\u003ctoken\u003e\"\n}\n```\n\n### Request w/ JWT Token\n* Request\n\nSend request with `Authorization` header \n\n```bash\n$ http http://localhost:8000/ 'Authorization: JWT \u003ctoken\u003e'\n```\n\n* Response\n```\nHTTP/1.1 200 OK\nAllow: GET, HEAD, OPTIONS\nContent-Length: 85\nContent-Type: application/json\nDate: Fri, 23 Nov 2018 02:21:46 GMT\nServer: WSGIServer/0.2 CPython/3.7.0\nVary: Accept\nX-Frame-Options: SAMEORIGIN\n\n{\n    \"snippets\": \"http://localhost:8000/snippets/\",\n    \"users\": \"http://localhost:8000/users/\"\n}\n```\n\n* If wrong token\n```\nHTTP/1.1 401 Unauthorized\nAllow: GET, HEAD, OPTIONS\nContent-Length: 38\nContent-Type: application/json\nDate: Fri, 23 Nov 2018 02:20:59 GMT\nServer: WSGIServer/0.2 CPython/3.7.0\nVary: Accept\nWWW-Authenticate: JWT realm=\"api\"\nX-Frame-Options: SAMEORIGIN\n\n{\n    \"detail\": \"Error decoding signature.\"\n}\n```\n\n* If signature was expired\n```\nHTTP/1.1 401 Unauthorized\nAllow: GET, HEAD, OPTIONS\nContent-Length: 35\nContent-Type: application/json\nDate: Fri, 23 Nov 2018 02:21:14 GMT\nServer: WSGIServer/0.2 CPython/3.7.0\nVary: Accept\nWWW-Authenticate: JWT realm=\"api\"\nX-Frame-Options: SAMEORIGIN\n\n{\n    \"detail\": \"Signature has expired.\"\n}\n```\n\n### Refresh Token\n* Request\n```\n$ http -j POST http://localhost:8000/auth/refresh/ token=\u003ctoken\u003e\n```\n\n* Response\n```\nHTTP/1.1 200 OK\nAllow: POST, OPTIONS\nContent-Length: 223\nContent-Type: application/json\nDate: Fri, 23 Nov 2018 02:46:38 GMT\nServer: WSGIServer/0.2 CPython/3.7.0\nVary: Accept\nX-Frame-Options: SAMEORIGIN\n\n{\n    \"token\": \"\u003cnew token\u003e\"\n}\n```\n\n### Verify Token\n* Request\n```\n$ http -j POST http://localhost:8000/auth/verify/ token=\u003ctoken\u003e\n```\n\n* Response\n```\nHTTP/1.1 200 OK\nAllow: POST, OPTIONS\nContent-Length: 223\nContent-Type: application/json\nDate: Fri, 23 Nov 2018 02:47:03 GMT\nServer: WSGIServer/0.2 CPython/3.7.0\nVary: Accept\nX-Frame-Options: SAMEORIGIN\n\n{\n    \"token\": \"\u003ctoken\u003e\"\n}\n```\n\n## References\n* Base codes: [http://raccoonyy.github.io/drf3-tutorial-1.html](http://raccoonyy.github.io/drf3-tutorial-1.html)\n* DRF Reference: [https://www.django-rest-framework.org/api-guide/pagination/](https://www.django-rest-framework.org/api-guide/pagination/)\n* JWT Authentication: [https://getblimp.github.io/django-rest-framework-jwt/](https://getblimp.github.io/django-rest-framework-jwt/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrmin%2Fdrf-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrmin%2Fdrf-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrmin%2Fdrf-tutorial/lists"}