# 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/45/81/9a06af515b43d0991b03abc855229569fcc32d24e1eaf610e7d7ae482e34/fyle_rest_auth-1.7.4.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.7.4",
"project_urls": {
"Homepage": "https://github.com/fylein/fyle-rest-auth"
},
"split_keywords": [
"fyle",
" rest",
" django-rest-framework",
" api",
" python",
" oauth 2"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "8fd285a2080409e2731d688c301945c264c76fb6bf88b50050d34605c4e2c2ba",
"md5": "724abf87374c47bbe19bac3ea640446d",
"sha256": "480558d637c82701f911107398807ea162d4f851eb21b6e687b09b8c69911dc2"
},
"downloads": -1,
"filename": "fyle_rest_auth-1.7.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "724abf87374c47bbe19bac3ea640446d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12351,
"upload_time": "2024-10-16T09:36:43",
"upload_time_iso_8601": "2024-10-16T09:36:43.394484Z",
"url": "https://files.pythonhosted.org/packages/8f/d2/85a2080409e2731d688c301945c264c76fb6bf88b50050d34605c4e2c2ba/fyle_rest_auth-1.7.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "45819a06af515b43d0991b03abc855229569fcc32d24e1eaf610e7d7ae482e34",
"md5": "706689017e07835d77c0030d860056a6",
"sha256": "469e1e4621e3baeaded1353588cc91c733ae785de778b5e7c7c86125031a01e8"
},
"downloads": -1,
"filename": "fyle_rest_auth-1.7.4.tar.gz",
"has_sig": false,
"md5_digest": "706689017e07835d77c0030d860056a6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8794,
"upload_time": "2024-10-16T09:36:44",
"upload_time_iso_8601": "2024-10-16T09:36:44.722956Z",
"url": "https://files.pythonhosted.org/packages/45/81/9a06af515b43d0991b03abc855229569fcc32d24e1eaf610e7d7ae482e34/fyle_rest_auth-1.7.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-16 09:36:44",
"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": "asgiref",
"specs": [
[
"==",
"3.4.1"
]
]
},
{
"name": "astroid",
"specs": [
[
"==",
"2.3.3"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2022.12.7"
]
]
},
{
"name": "chardet",
"specs": [
[
"==",
"3.0.4"
]
]
},
{
"name": "charset-normalizer",
"specs": [
[
"==",
"2.0.8"
]
]
},
{
"name": "Django",
"specs": [
[
"==",
"3.2.14"
]
]
},
{
"name": "django-rest-framework",
"specs": [
[
"==",
"0.1.0"
]
]
},
{
"name": "djangorestframework",
"specs": [
[
"==",
"3.11.2"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"2.8"
]
]
},
{
"name": "isort",
"specs": [
[
"==",
"4.3.21"
]
]
},
{
"name": "lazy-object-proxy",
"specs": [
[
"==",
"1.4.3"
]
]
},
{
"name": "mccabe",
"specs": [
[
"==",
"0.6.1"
]
]
},
{
"name": "pylint",
"specs": [
[
"==",
"2.4.4"
]
]
},
{
"name": "pylint-django",
"specs": [
[
"==",
"2.0.13"
]
]
},
{
"name": "pylint-plugin-utils",
"specs": [
[
"==",
"0.6"
]
]
},
{
"name": "pytz",
"specs": [
[
"==",
"2019.3"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.26.0"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.14.0"
]
]
},
{
"name": "sqlparse",
"specs": [
[
"==",
"0.3.0"
]
]
},
{
"name": "typed-ast",
"specs": [
[
"==",
"1.4.1"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"1.26.5"
]
]
},
{
"name": "wrapt",
"specs": [
[
"==",
"1.11.2"
]
]
},
{
"name": "fyle-djangoq2",
"specs": [
[
"==",
"1.0.0"
]
]
}
],
"lcname": "fyle-rest-auth"
}