This commit is contained in:
@@ -37,15 +37,24 @@ async def check_auth(req) -> str | None:
|
||||
try:
|
||||
# Asynchronous HTTP request to the authentication server
|
||||
async with ClientSession() as session:
|
||||
async with session.post(AUTH_URL, json=gql, headers=headers) as response:
|
||||
print(f'[services.auth] HTTP Response {response.status} {await response.text()}')
|
||||
async with session.post(
|
||||
AUTH_URL, json=gql, headers=headers
|
||||
) as response:
|
||||
print(
|
||||
f'[services.auth] HTTP Response {response.status} {await response.text()}'
|
||||
)
|
||||
if response.status == 200:
|
||||
data = await response.json()
|
||||
errors = data.get('errors')
|
||||
if errors:
|
||||
print(f'[services.auth] errors: {errors}')
|
||||
print(f'errors: {errors}')
|
||||
else:
|
||||
user_id = data.get('data', {}).get(query_name, {}).get('claims', {}).get('sub')
|
||||
user_id = (
|
||||
data.get('data', {})
|
||||
.get(query_name, {})
|
||||
.get('claims', {})
|
||||
.get('sub')
|
||||
)
|
||||
if user_id:
|
||||
print(f'[services.auth] got user_id: {user_id}')
|
||||
return user_id
|
||||
|
Reference in New Issue
Block a user