{"id":13849470,"url":"https://github.com/jasonbeverage/django-token","last_synced_at":"2025-04-13T16:08:08.919Z","repository":{"id":22250401,"uuid":"25583980","full_name":"jasonbeverage/django-token","owner":"jasonbeverage","description":"Simple token based authentication for Django","archived":false,"fork":false,"pushed_at":"2023-09-11T13:51:16.000Z","size":13,"stargazers_count":12,"open_issues_count":5,"forks_count":12,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T16:08:05.988Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jasonbeverage.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}},"created_at":"2014-10-22T13:51:01.000Z","updated_at":"2024-08-21T09:35:18.000Z","dependencies_parsed_at":"2024-01-18T09:04:50.872Z","dependency_job_id":"975aaa17-bbc5-47ed-9c55-a7b08bb50cf4","html_url":"https://github.com/jasonbeverage/django-token","commit_stats":{"total_commits":22,"total_committers":2,"mean_commits":11.0,"dds":0.2727272727272727,"last_synced_commit":"87ddcec6a51abde3fcce757f889cf5e482cbe463"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonbeverage%2Fdjango-token","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonbeverage%2Fdjango-token/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonbeverage%2Fdjango-token/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonbeverage%2Fdjango-token/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonbeverage","download_url":"https://codeload.github.com/jasonbeverage/django-token/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741206,"owners_count":21154255,"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":[],"created_at":"2024-08-04T19:01:19.042Z","updated_at":"2025-04-13T16:08:08.896Z","avatar_url":"https://github.com/jasonbeverage.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"django-token\n============\n\nSimple token based authentication for Django.\n\nThis draws inspiration from the Django Rest Framework token based authentication scheme but allows you to use it without using Django Rest Framework.\n\n## Installing\n\nInstall from pip\n```\nsudo pip install django_token\n```\n\nAdd the middleware to your MIDDLEWARE_CLASSES\n\n```python\nMIDDLEWARE_CLASSES = (\n    # Other middleware\n    'django_token.middleware.TokenMiddleware',\n )\n```\n\nAdd the authenticaton backend to your AUTHENTICATION_BACKENDS\n```python\nAUTHENTICATION_BACKENDS = (\n    'django.contrib.auth.backends.ModelBackend',\n    'django_token.backends.TokenBackend'\n)\n```\n\n## Creating tokens\nYou can create tokens for users using whatever workflow you'd like.\n```python\nfrom django_token.models import Token\n\ntoken = Token.objects.create(user=myuser)\n```\n\nIf you REALLY want to reset all the tokens in your database, you can use the reset_tokens management command.\n\n```\npython manage.py reset_tokens\n```\n\nThis is useful when you've just installed django-token, but is otherwise dangerous :)\n\n## Token in headers\n\nThe user's token should be passed in on every request in the HTTP authorization header.\n\nUsing [requests](http://docs.python-requests.org/en/latest/)\n```python\nimport requests\nresponse = requests.get(\n    \"http://myserver.com/api/stuff\",\n    headers={\"Authorization\": \"token r454f2529f2cd27e1722e67a624b2b18335e6c21\"}\n)\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonbeverage%2Fdjango-token","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonbeverage%2Fdjango-token","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonbeverage%2Fdjango-token/lists"}