Skip to content

Commit

Permalink
Update Fyle Credentials on login async'ly (#27)
Browse files Browse the repository at this point in the history
* Update Fyle Credentials on login async'ly

* indent
  • Loading branch information
ashwin1111 authored Jan 13, 2023
1 parent b64fad0 commit 40359e1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions fyle_rest_auth/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from django.conf import settings
from django.utils.module_loading import import_string

from django_q.tasks import async_task

from .utils import AuthUtils, post_request, get_request
from .models import AuthToken

Expand Down Expand Up @@ -41,6 +43,12 @@ def validate_code_and_login(request):
tokens['user']['org_id'] = employee_info['data']['org']['id']
tokens['user']['org_name'] = employee_info['data']['org']['name']

# Update Fyle Credentials with latest healthy token
async_task(
'apps.workspaces.tasks.async_update_fyle_credentials',
employee_info['data']['org']['id'], tokens['refresh_token']
)

return tokens

except Exception as error:
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ charset-normalizer==2.0.8
Django==3.1.14
django-rest-framework==0.1.0
djangorestframework==3.11.2
django-q==1.3.4
idna==2.8
isort==4.3.21
lazy-object-proxy==1.4.3
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name='fyle-rest-auth',
version='1.2.0',
version='1.3.0',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Django application to implement OAuth 2.0 using Fyle in Django rest framework',
Expand All @@ -19,7 +19,7 @@
url='https://github.com/fylein/fyle-rest-auth',
packages=setuptools.find_packages(),
install_requires=['requests>=2.25.0', 'django>=3.0.2',
'django-rest-framework==0.1.0'],
'django-rest-framework==0.1.0', 'django-q==1.3.4'],
include_package_data=True,
classifiers=[
'Framework :: Django',
Expand Down

0 comments on commit 40359e1

Please sign in to comment.