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.4.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

fyle_rest_auth-1.7.4-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fyle_rest_auth-1.7.4.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.4.tar.gz
Algorithm Hash digest
SHA256 469e1e4621e3baeaded1353588cc91c733ae785de778b5e7c7c86125031a01e8
MD5 706689017e07835d77c0030d860056a6
BLAKE2b-256 45819a06af515b43d0991b03abc855229569fcc32d24e1eaf610e7d7ae482e34

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for fyle_rest_auth-1.7.4-py3-none-any.whl
Algorithm Hash digest
SHA256 480558d637c82701f911107398807ea162d4f851eb21b6e687b09b8c69911dc2
MD5 724abf87374c47bbe19bac3ea640446d
BLAKE2b-256 8fd285a2080409e2731d688c301945c264c76fb6bf88b50050d34605c4e2c2ba

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