From a7038893191c1e4e0c7f4a3c854735cfb4e78fc9 Mon Sep 17 00:00:00 2001 From: Tracker-Friendly Date: Thu, 18 Apr 2024 08:52:59 +0100 Subject: [PATCH] Test for server side --- main | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/main b/main index 6cd2192..ac93889 100644 --- a/main +++ b/main @@ -248,14 +248,15 @@ async def apiopeniduserinfo(): return datatemplate -@app.route("/api/auth", methods=("GET", "POST")) +@app.route("/api/auth", methods=("GET")) async def apiauthenticate(): - if request.method == "POST": - data = await request.get_json() - secretKey = data["secretKey"] - appId = data["appId"] - code = data["code"] - codemethod = data["codemethod"] + if request.method == "GET": + secretKey = request.headers.get["secretKey"] + appId = request.args.get["client_id"] + code = request.args.get["code_challenge"] + codemethod = request.args.get["code_challenge_method"] + redirect = request.args.get["redirect_uri"] + state = request.args.get["state"] userCookie = get_session(secretKey) user = get_user(userCookie["id"]) @@ -299,7 +300,7 @@ async def apiauthenticate(): conn.close() if secretkey: - return secretkey, 200 + return redirect(redirect_uri + "?code=" + secretkey + "&state=" + state), 200 else: return {}, 400