Test for server side
This commit is contained in:
parent
b9b02d5e7d
commit
a703889319
17
main
17
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
|
||||
|
||||
|
|
Reference in New Issue