Skip to content

Commit

Permalink
feat: Adding loggers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashutosh619-sudo committed Oct 9, 2024
1 parent a9422ed commit c38e146
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
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 and user unique key %s, %s', email, user)

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

0 comments on commit c38e146

Please sign in to comment.