Skip to content

Commit

Permalink
Update connector.py
Browse files Browse the repository at this point in the history
  • Loading branch information
untitledds authored Dec 2, 2024
1 parent c77d25b commit 2e6c67e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions back/taiga_contrib_access_token_auth/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,22 @@ def get_user_info(access_token):
"details": str(e)
})

user_info = userinfo_response.json()
try:
user_info = userinfo_response.json()
except ValueError as e:
logger.error(f"Failed to parse JSON response: {e}")
raise ConnectorBaseException({
"error_message": "Failed to parse JSON response",
"details": str(e)
})

# Проверка обязательных полей
required_fields = [settings.USER_FIELDS["GUID"], settings.USER_FIELDS["USERNAME"], settings.USER_FIELDS["EMAIL"], settings.USER_FIELDS["FULL_NAME"]]
required_fields = [
settings.USER_FIELDS["GUID"],
settings.USER_FIELDS["USERNAME"],
settings.USER_FIELDS["EMAIL"],
settings.USER_FIELDS["FULL_NAME"]
]
for field in required_fields:
if field not in user_info:
logger.error(f"Missing required field '{field}' in user info response")
Expand Down

0 comments on commit 2e6c67e

Please sign in to comment.