Skip to content

Commit

Permalink
feat: Adding loggers (#44)
Browse files Browse the repository at this point in the history
* feat: Adding loggers

* comment resolved
  • Loading branch information
Ashutosh619-sudo authored Oct 13, 2024
1 parent a9422ed commit c67eb85
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion fyle_rest_auth/authentication.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from typing import Dict

from django.contrib.auth import get_user_model
Expand All @@ -13,6 +14,9 @@
User = get_user_model()
auth = AuthUtils()

logger = logging.getLogger(__name__)
logger.level = logging.INFO


class FyleJWTAuthentication(BaseAuthentication):
"""
Expand Down Expand Up @@ -71,9 +75,10 @@ def validate_token(access_token_string: str, origin_address: str) -> Dict:
email = cache.get(email_unique_key)
user = cache.get(user_unique_key)

logger.info('email, user unique key, email unique key %s, %s, %s', email, user_unique_key, email_unique_key)

if not (email and user):
cache.delete_many([email_unique_key, user_unique_key])

try:
employee_info = get_fyle_admin(access_token_string.split(' ')[1], origin_address)
except Exception:
Expand Down
1 change: 1 addition & 0 deletions fyle_rest_auth/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def validate_code_and_login(request):
tokens = auth.generate_fyle_refresh_token(authorization_code=authorization_code)

employee_info = get_fyle_admin(tokens['access_token'], auth.get_origin_address(request))
logger.info('Employee Info %s', employee_info)
users = get_user_model()

user, _ = users.objects.get_or_create(
Expand Down
2 changes: 1 addition & 1 deletion 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.7.2',
version='1.7.3',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Django application to implement OAuth 2.0 using Fyle in Django rest framework',
Expand Down

0 comments on commit c67eb85

Please sign in to comment.