query-string-fix
This commit is contained in:
parent
0c73f376a2
commit
8ee7a1ffaa
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user