This commit is contained in:
parent
2fb48d76b6
commit
2518e0357b
|
@ -38,15 +38,19 @@ async def check_auth(req) -> (bool, int | None):
|
||||||
if response.status == 200:
|
if response.status == 200:
|
||||||
# Parsing JSON response
|
# Parsing JSON response
|
||||||
data = await response.json()
|
data = await response.json()
|
||||||
user_id = data.get("data", {}).get(query_name, {}).get("claims", {}).get("sub")
|
errors = data.get("errors")
|
||||||
|
if errors:
|
||||||
if user_id:
|
print(f"Auth connector errors: {errors}")
|
||||||
# Logging the retrieved user ID
|
|
||||||
print(f"User ID retrieved: {user_id}")
|
|
||||||
return True, user_id
|
|
||||||
else:
|
else:
|
||||||
# Logging when no user ID is found in the response
|
user_id = data.get("data", {}).get(query_name, {}).get("claims", {}).get("sub")
|
||||||
print("No user ID found in the response")
|
|
||||||
|
if user_id:
|
||||||
|
# Logging the retrieved user ID
|
||||||
|
print(f"User ID retrieved: {user_id}")
|
||||||
|
return True, user_id
|
||||||
|
else:
|
||||||
|
# Logging when no user ID is found in the response
|
||||||
|
print("No user ID found in the response")
|
||||||
else:
|
else:
|
||||||
# Logging when the request to the authentication server fails
|
# Logging when the request to the authentication server fails
|
||||||
print(f"Request failed with status: {response.status}")
|
print(f"Request failed with status: {response.status}")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user