Skip to main content

Django application to implement OAuth 2.0 using Fyle in Django rest framework

Project description

Fyle Rest Auth

Django application to implement OAuth 2.0 using Fyle in Django rest framework

Installation

This project requires Python 3+ and Requests library (pip install requests).

  1. Download this project and use it (copy it in your project, etc).

  2. Install it from pip.

     $ 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
INSTALLED_APPS = [
    ...,
    'fyle_rest_auth'
]
  • Add authentication class to settings file
REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'fyle_rest_auth.authentication.FyleJWTAuthentication',
    ),
}
  • Add serializer path in settings file
FYLE_REST_AUTH_SERIALIZERS = {
    'USER_DETAILS_SERIALIZER': 'users.serializers.UserSerializer'
}
  • Add the constants in settings file
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.
urlpatterns = [
    path('api/admin/', admin.site.urls),
    path('api/auth/', include('fyle_rest_auth.urls')),
    
]
  • Configure cache in settings file
CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.db.DatabaseCache',
        'LOCATION': 'your_cache_table',
    }
}
  • Creating the cache table
python manage.py createcachetable

License

This project is licensed under the MIT License - see the LICENSE file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fyle_rest_auth-1.7.3.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

fyle_rest_auth-1.7.3-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file fyle_rest_auth-1.7.3.tar.gz.

File metadata

  • Download URL: fyle_rest_auth-1.7.3.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for fyle_rest_auth-1.7.3.tar.gz
Algorithm Hash digest
SHA256 bc7686a94080acb7376ad8362dfee19a5788fb9e0651652a5dca5e101501dd78
MD5 0a14128455c502cd034d18646232991e
BLAKE2b-256 d22dbb5348a14294729c205c8811f434729bdea3b658ae664c1e7ccb5070dfda

See more details on using hashes here.

File details

Details for the file fyle_rest_auth-1.7.3-py3-none-any.whl.

File metadata

File hashes

Hashes for fyle_rest_auth-1.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bd882c1d56667bd7a7448e34edc37b2829fb066002283db9cfd21b56c85318dc
MD5 53ea12b2c0d1023b30c009e19d92c4c6
BLAKE2b-256 11a4366cb9ba9c4224e05d70de440412bd161206edd25bbb4abafe1a9e26a19f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page