# 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/4d/50/6df4587f2d2db9b732fb2576f151c6a48dcb7b2ee51485e079b7cd50518f/fyle_rest_auth-1.7.2.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.2",
"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": "5de1afdc04c2d61252942c2dd617c34b957bc18dc744d93b3d4b68cf896ac7bc",
"md5": "9fa5624de9c97b51e29acd29c496bf4b",
"sha256": "15861f31a0c6a1560f46cca04510203a7a0d1dabcf95b9b4459bf89cb18e0081"
},
"downloads": -1,
"filename": "fyle_rest_auth-1.7.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9fa5624de9c97b51e29acd29c496bf4b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 12244,
"upload_time": "2024-04-26T15:27:20",
"upload_time_iso_8601": "2024-04-26T15:27:20.654389Z",
"url": "https://files.pythonhosted.org/packages/5d/e1/afdc04c2d61252942c2dd617c34b957bc18dc744d93b3d4b68cf896ac7bc/fyle_rest_auth-1.7.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "4d506df4587f2d2db9b732fb2576f151c6a48dcb7b2ee51485e079b7cd50518f",
"md5": "4947699a4695c7c203b50c5417609396",
"sha256": "8901819be396c23cbd01bbc3275b51a8ef8f7dc21e6dbd04ab9b979fb8fedc58"
},
"downloads": -1,
"filename": "fyle_rest_auth-1.7.2.tar.gz",
"has_sig": false,
"md5_digest": "4947699a4695c7c203b50c5417609396",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8724,
"upload_time": "2024-04-26T15:27:21",
"upload_time_iso_8601": "2024-04-26T15:27:21.981260Z",
"url": "https://files.pythonhosted.org/packages/4d/50/6df4587f2d2db9b732fb2576f151c6a48dcb7b2ee51485e079b7cd50518f/fyle_rest_auth-1.7.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-26 15:27:21",
"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"
}