# 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
![Screenshot 2023-03-21 at 14 47 02](https://user-images.githubusercontent.com/7786556/226643622-893b631d-d353-4833-8def-78f61ea77561.png)
## Add token view
![Screenshot 2023-03-21 at 14 47 19](https://user-images.githubusercontent.com/7786556/226643580-ac761fd7-91a9-4c5c-898b-4cc1daf9d812.png)
# 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": "",
"name": "django-apitokens",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "django,api,restframework,tokens,self-service",
"author": "",
"author_email": "InfoSec Engineering <surface@paddypowerbetfair.com>",
"download_url": "https://files.pythonhosted.org/packages/5a/87/81d280847f1d29e57fb186f6838d9d98dc978fbb914da7842ba530b971a3/django-apitokens-0.0.2.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![Screenshot 2023-03-21 at 14 47 02](https://user-images.githubusercontent.com/7786556/226643622-893b631d-d353-4833-8def-78f61ea77561.png)\n\n\n## Add token view\n\n![Screenshot 2023-03-21 at 14 47 19](https://user-images.githubusercontent.com/7786556/226643580-ac761fd7-91a9-4c5c-898b-4cc1daf9d812.png)\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.2",
"project_urls": null,
"split_keywords": [
"django",
"api",
"restframework",
"tokens",
"self-service"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a4021be312d0f54eec08b894595d70d59a44d14157d127de0e23c42bb048226d",
"md5": "5f44b9211cae3722cab186663fa8373b",
"sha256": "d464108f600731b3fa8de4fbf103993b0b7e330170410ee978f9b7698ec73c9d"
},
"downloads": -1,
"filename": "django_apitokens-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5f44b9211cae3722cab186663fa8373b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 6564,
"upload_time": "2023-07-27T10:46:35",
"upload_time_iso_8601": "2023-07-27T10:46:35.533964Z",
"url": "https://files.pythonhosted.org/packages/a4/02/1be312d0f54eec08b894595d70d59a44d14157d127de0e23c42bb048226d/django_apitokens-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5a8781d280847f1d29e57fb186f6838d9d98dc978fbb914da7842ba530b971a3",
"md5": "c1a2f9d03c4e52b19ad2a7f15b359247",
"sha256": "33c7e4a78f37bded037264352dc273575dc4d446a4a30a12fd9f546276a08581"
},
"downloads": -1,
"filename": "django-apitokens-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "c1a2f9d03c4e52b19ad2a7f15b359247",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 10496,
"upload_time": "2023-07-27T10:46:37",
"upload_time_iso_8601": "2023-07-27T10:46:37.005886Z",
"url": "https://files.pythonhosted.org/packages/5a/87/81d280847f1d29e57fb186f6838d9d98dc978fbb914da7842ba530b971a3/django-apitokens-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-27 10:46:37",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "django-apitokens"
}