Fyle OAuth 2.0 provider for django-allauth, lets you associate Fyle accounts with your User accounts.
Install django-allauth and configure it.
-
Install fyle-django-allauth
pip install fyle-django-allauth
-
Include 'fyle_allauth' in the INSTALLED_APPS section of settings.py :
INSTALLED_APPS = ( ... 'django.contrib.sites', 'allauth', 'allauth.account', 'allauth.socialaccount', 'fyle_allauth' # new
-
Fyle App registration (get your client_id and client_secret here)
- Login to Fyle
- Goto settings and click on Developers
- Click on create new app, enter the details and select type as OAuth 2.0
- For Redirect URI enter
- 'http://localhost:8000/accounts/fyle/login/callback/' for development
- 'https://your_domain/accounts/fyle/login/callback/' for production
- Note down the client_secret and client_id
-
Open django-admin and create a new record under Social Applications Select Fyle as provider and enter the above noted client_secret and client_id.
Final step is to add our site to the Chosen sites on the bottom.
-
Visit http://localhost:8000/accounts/fyle/login to login using your Fyle account.
-
If using a custom user model then add the below lines to settings.py
# For custom user model that has email as the user identifying field ACCOUNT_USER_MODEL_USERNAME_FIELD = None ACCOUNT_USERNAME_REQUIRED = False ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_AUTHENTICATION_METHOD = 'email' # Disable verification mail [optional] ACCOUNT_EMAIL_VERIFICATION = 'none'
-
If you are using a different application then update your base URL by adding the below line to settings.py
FYLE_BASE_URL = 'https://app.fyle.in'
For more info on customisation refer the django-allauth documentation