graphiql-fix
All checks were successful
Deploy to notifier / deploy (push) Successful in 1m32s

This commit is contained in:
Untone 2024-02-03 19:36:17 +03:00
parent 9f7143d756
commit 3e0f7b0521
2 changed files with 4 additions and 14 deletions

View File

@ -16,7 +16,6 @@ from services.rediscache import redis
from settings import DEV_SERVER_PID_FILE_NAME, MODE, SENTRY_DSN
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger('\t[main]\t')
logger.setLevel(logging.DEBUG)
@ -54,4 +53,4 @@ async def shutdown():
app = Starlette(debug=True, on_startup=[start_up], on_shutdown=[shutdown])
app.mount('/', GraphQL(schema, debug=True))
app.mount('/', GraphQL(schema, graphiql=True, debug=True))

View File

@ -37,24 +37,15 @@ 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'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