# django-apitokens
Generate tokens compatible with Django Restframework (`drf`) from your Django Admin view:
- Create new tokens at will (after being generated, they no longer can be reversed, since only a digest is stored in the database).
- Add expirity dates (supports time and date)
- Remove tokens when you no longer need them.
## My Token view

## Add token view

# Install
- Install the python package: `pip install django-apitokens`
- Add `apitokens` to your Django installed apps:
```python
# In your settings.py
INSTALLED_APPS = [
...
'apitokens',
]
```
- Ensure you are using `knox` `TokenAuthentication` class:
```python
# In your settings.py
REST_FRAMEWORK = {
...,
'DEFAULT_AUTHENTICATION_CLASSES': (
'knox.auth.TokenAuthentication',
...,
),
...,
}
```
- You are set to use tokens generated through this app as a way to login with the DRF framework.
# Contributing
To contribute code to this app, ensure you're following the [community guidelines](https://github.com/surface-security/guidelines#contributing)
Raw data
{
"_id": null,
"home_page": null,
"name": "django-apitokens",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "django, api, restframework, tokens, self-service",
"author": null,
"author_email": "InfoSec Engineering <surface@paddypowerbetfair.com>",
"download_url": "https://files.pythonhosted.org/packages/86/04/e7fef5953a6918741257ed9df43b1970d7ab3825f526ca7e2daf1761ed9e/django_apitokens-0.0.3.tar.gz",
"platform": null,
"description": "# django-apitokens\n\nGenerate tokens compatible with Django Restframework (`drf`) from your Django Admin view:\n- Create new tokens at will (after being generated, they no longer can be reversed, since only a digest is stored in the database).\n- Add expirity dates (supports time and date)\n- Remove tokens when you no longer need them.\n\n## My Token view\n\n\n\n\n## Add token view\n\n\n\n\n# Install\n\n- Install the python package: `pip install django-apitokens` \n- Add `apitokens` to your Django installed apps:\n\n```python\n# In your settings.py\nINSTALLED_APPS = [\n ...\n 'apitokens',\n]\n```\n\n- Ensure you are using `knox` `TokenAuthentication` class:\n\n```python\n# In your settings.py\nREST_FRAMEWORK = {\n ...,\n 'DEFAULT_AUTHENTICATION_CLASSES': (\n 'knox.auth.TokenAuthentication',\n ...,\n ),\n ...,\n}\n```\n\n- You are set to use tokens generated through this app as a way to login with the DRF framework.\n\n# Contributing\n\nTo contribute code to this app, ensure you're following the [community guidelines](https://github.com/surface-security/guidelines#contributing)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Generate API tokens for django-restframework",
"version": "0.0.3",
"project_urls": null,
"split_keywords": [
"django",
" api",
" restframework",
" tokens",
" self-service"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "8322beaf67cc451b60ebbb700e266ed8c3c87598a18f74570db9daacc678ffcf",
"md5": "947178cda165e0816978a0a8cc4225c9",
"sha256": "677d43f0c65f284d6696c5de215cd86ddc4ff28e1ac7a1c2b0adf77dda5c8e20"
},
"downloads": -1,
"filename": "django_apitokens-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "947178cda165e0816978a0a8cc4225c9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6601,
"upload_time": "2025-07-10T10:07:34",
"upload_time_iso_8601": "2025-07-10T10:07:34.428356Z",
"url": "https://files.pythonhosted.org/packages/83/22/beaf67cc451b60ebbb700e266ed8c3c87598a18f74570db9daacc678ffcf/django_apitokens-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8604e7fef5953a6918741257ed9df43b1970d7ab3825f526ca7e2daf1761ed9e",
"md5": "85dafbda09be38d08ecaf946a5ea7fcd",
"sha256": "c172157ad7fe20d3449160e502a271721417005ef8a396d094d67f091ffa2431"
},
"downloads": -1,
"filename": "django_apitokens-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "85dafbda09be38d08ecaf946a5ea7fcd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 10609,
"upload_time": "2025-07-10T10:07:35",
"upload_time_iso_8601": "2025-07-10T10:07:35.433560Z",
"url": "https://files.pythonhosted.org/packages/86/04/e7fef5953a6918741257ed9df43b1970d7ab3825f526ca7e2daf1761ed9e/django_apitokens-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-10 10:07:35",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "django-apitokens"
}