# Fyle Rest Auth
Django application to implement OAuth 2.0 using Fyle in Django rest framework
## Installation
This project requires [Python 3+](https://www.python.org/downloads/) and [Requests](https://pypi.org/project/requests/) library (pip install requests).
1. Download this project and use it (copy it in your project, etc).
2. Install it from [pip](https://pypi.org).
$ pip install fyle-rest-auth
## Usage
To use this Django app you'll need fyle credentials used for OAuth2 authentication: **client ID**, **client secret** and **refresh token**.
* Add fyle rest auth in INSTALLED_APPS in settings file
```pythonstub
INSTALLED_APPS = [
...,
'fyle_rest_auth'
]
```
* Add authentication class to settings file
```pythonstub
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'fyle_rest_auth.authentication.FyleJWTAuthentication',
),
}
```
* Add serializer path in settings file
```pythonstub
FYLE_REST_AUTH_SERIALIZERS = {
'USER_DETAILS_SERIALIZER': 'users.serializers.UserSerializer'
}
```
* Add the constants in settings file
```pythonstub
FYLE_BASE_URL = '<Fyle Base URL>'
FYLE_TOKEN_URI = '<Fyle Token URI>'
FYLE_CLIENT_ID = '<Fyle Client Id>'
FYLE_CLIENT_SECRET = '<Fyle Client Secret>'
```
* Include urls in the the django app.
```pythonstub
urlpatterns = [
path('api/admin/', admin.site.urls),
path('api/auth/', include('fyle_rest_auth.urls')),
]
```
* Configure cache in settings file
```pythonstub
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
'LOCATION': 'your_cache_table',
}
}
```
* Creating the cache table
```pythonstub
python manage.py createcachetable
```
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
Raw data
{
"_id": null,
"home_page": "https://github.com/fylein/fyle-rest-auth",
"name": "fyle-rest-auth",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "fyle, rest, django-rest-framework, api, python, oauth 2",
"author": "Shwetabh Kumar",
"author_email": "shwetabh.kumar@fyle.in",
"download_url": "https://files.pythonhosted.org/packages/8a/19/4b8fd5342064b54c8c853f3380f61bffb12b4692365ddddde80513ee923a/fyle_rest_auth-1.8.1.tar.gz",
"platform": null,
"description": "# Fyle Rest Auth\n\nDjango application to implement OAuth 2.0 using Fyle in Django rest framework\n\n\n## Installation\n\nThis project requires [Python 3+](https://www.python.org/downloads/) and [Requests](https://pypi.org/project/requests/) library (pip install requests).\n\n1. Download this project and use it (copy it in your project, etc).\n2. Install it from [pip](https://pypi.org).\n \n $ pip install fyle-rest-auth\n\n## Usage\n\nTo use this Django app you'll need fyle credentials used for OAuth2 authentication: **client ID**, **client secret** and **refresh token**.\n\n* Add fyle rest auth in INSTALLED_APPS in settings file\n```pythonstub\nINSTALLED_APPS = [\n ...,\n 'fyle_rest_auth'\n]\n```\n\n* Add authentication class to settings file\n```pythonstub\nREST_FRAMEWORK = {\n 'DEFAULT_PERMISSION_CLASSES': (\n 'rest_framework.permissions.IsAuthenticated',\n ),\n 'DEFAULT_AUTHENTICATION_CLASSES': (\n 'fyle_rest_auth.authentication.FyleJWTAuthentication',\n ),\n}\n```\n\n* Add serializer path in settings file\n```pythonstub\nFYLE_REST_AUTH_SERIALIZERS = {\n 'USER_DETAILS_SERIALIZER': 'users.serializers.UserSerializer'\n}\n```\n\n* Add the constants in settings file\n```pythonstub\nFYLE_BASE_URL = '<Fyle Base URL>'\nFYLE_TOKEN_URI = '<Fyle Token URI>'\nFYLE_CLIENT_ID = '<Fyle Client Id>'\nFYLE_CLIENT_SECRET = '<Fyle Client Secret>'\n```\n\n* Include urls in the the django app.\n```pythonstub\nurlpatterns = [\n path('api/admin/', admin.site.urls),\n path('api/auth/', include('fyle_rest_auth.urls')),\n \n]\n```\n* Configure cache in settings file\n```pythonstub\nCACHES = {\n 'default': {\n 'BACKEND': 'django.core.cache.backends.db.DatabaseCache',\n 'LOCATION': 'your_cache_table',\n }\n}\n```\n\n* Creating the cache table\n```pythonstub\npython manage.py createcachetable\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django application to implement OAuth 2.0 using Fyle in Django rest framework",
"version": "1.8.1",
"project_urls": {
"Homepage": "https://github.com/fylein/fyle-rest-auth"
},
"split_keywords": [
"fyle",
" rest",
" django-rest-framework",
" api",
" python",
" oauth 2"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "96b7c78d495e85bac057066e71b750410e123574736d863cefdd32a1a816f26c",
"md5": "34203273bf01151b22ba51aa77ca751c",
"sha256": "34da50eddb0121c80525ee066dbff0257b281630ea2df469311b62d936cfd424"
},
"downloads": -1,
"filename": "fyle_rest_auth-1.8.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "34203273bf01151b22ba51aa77ca751c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12416,
"upload_time": "2025-03-07T07:59:55",
"upload_time_iso_8601": "2025-03-07T07:59:55.546348Z",
"url": "https://files.pythonhosted.org/packages/96/b7/c78d495e85bac057066e71b750410e123574736d863cefdd32a1a816f26c/fyle_rest_auth-1.8.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8a194b8fd5342064b54c8c853f3380f61bffb12b4692365ddddde80513ee923a",
"md5": "afdfe5c0e5c44f28177f4c999b965d01",
"sha256": "a2afb0d974d7cce8aff9386f03a422c3ca2428af67c2a7e50fe67c2cb9c2a2ef"
},
"downloads": -1,
"filename": "fyle_rest_auth-1.8.1.tar.gz",
"has_sig": false,
"md5_digest": "afdfe5c0e5c44f28177f4c999b965d01",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8922,
"upload_time": "2025-03-07T07:59:56",
"upload_time_iso_8601": "2025-03-07T07:59:56.775455Z",
"url": "https://files.pythonhosted.org/packages/8a/19/4b8fd5342064b54c8c853f3380f61bffb12b4692365ddddde80513ee923a/fyle_rest_auth-1.8.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-07 07:59:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fylein",
"github_project": "fyle-rest-auth",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "Django",
"specs": [
[
"==",
"4.2.20"
]
]
},
{
"name": "djangorestframework",
"specs": [
[
"==",
"3.15.2"
]
]
},
{
"name": "isort",
"specs": [
[
"==",
"4.3.21"
]
]
},
{
"name": "pylint",
"specs": [
[
"==",
"2.7.4"
]
]
},
{
"name": "pylint-django",
"specs": [
[
"==",
"2.0.13"
]
]
},
{
"name": "pylint-plugin-utils",
"specs": [
[
"==",
"0.6"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2024.2"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.17.0"
]
]
},
{
"name": "fyle-djangoq2",
"specs": [
[
"==",
"1.0.0"
]
]
}
],
"lcname": "fyle-rest-auth"
}