diff --git a/services/auth.py b/services/auth.py index 442ec9d..6e9f8b2 100644 --- a/services/auth.py +++ b/services/auth.py @@ -1,4 +1,3 @@ -import json from functools import wraps from httpx import AsyncClient, HTTPError from settings import AUTH_URL @@ -10,14 +9,13 @@ INTERNAL_AUTH_SERVER = "v2.discours" in AUTH_URL or "testapi.discours" in AUTH_U async def check_auth(req): token = req.headers.get("Authorization") print(f"[services.auth] checking auth token: {token}") - gql = ( - {"mutation": "{ getSession { user { id } } }"} + gql = ("mutation { getSession { user { id } } }" if INTERNAL_AUTH_SERVER - else {"query": "{ session { user { id } } }"} + else "query { session { user { id } } }" ) headers = {"Authorization": token, "Content-Type": "application/json"} async with AsyncClient() as client: - response = await client.post(AUTH_URL, headers=headers, data=json.dumps(gql)) + response = await client.post(AUTH_URL, headers=headers, data=gql) print(f"{response.text}") if response.status_code != 200: return False, None