From dfa2d18a639dee3cc7a79e4d696894643aecb524 Mon Sep 17 00:00:00 2001 From: nex Date: Mon, 19 Feb 2024 12:04:09 +0000 Subject: [PATCH] Fix invalid scopes being generated --- web/server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/web/server.py b/web/server.py index cc16801..a54d80f 100644 --- a/web/server.py +++ b/web/server.py @@ -344,12 +344,12 @@ async def bridge_bind_new(mx_id: str): raise HTTPException(409, "Account already bound") if not OAUTH_ENABLED: - raise HTTPException(503) + raise HTTPException(status.HTTP_503_SERVICE_UNAVAILABLE) token = secrets.token_urlsafe() app.state.binds[token] = mx_id url = discord.utils.oauth_url( - OAUTH_ID, redirect_uri=OAUTH_REDIRECT_URI, scopes=("identify") + OAUTH_ID, redirect_uri=OAUTH_REDIRECT_URI, scopes=("identify",) ) + f"&state={token}&prompt=none" return { "status": "pending", @@ -383,7 +383,7 @@ async def bridge_bind_delete(mx_id: str, code: str = None, state: str = None): token = secrets.token_urlsafe() app.state.binds[token] = mx_id url = discord.utils.oauth_url( - OAUTH_ID, redirect_uri=OAUTH_REDIRECT_URI, scopes=("identify") + OAUTH_ID, redirect_uri=OAUTH_REDIRECT_URI, scopes=("identify",) ) + f"&state={token}&prompt=none" return JSONResponse({"status": "pending", "url": url}) else: