fix: QueryParams model
This commit is contained in:
parent
aaec7b7bc4
commit
27afd95229
1 changed files with 2 additions and 2 deletions
4
app.py
4
app.py
|
@ -65,14 +65,14 @@ async def link():
|
||||||
|
|
||||||
@app.get('/callback/steam')
|
@app.get('/callback/steam')
|
||||||
async def setup(request: Request, response: Response):
|
async def setup(request: Request, response: Response):
|
||||||
valid = await validate(request.query_params)
|
valid = await validate(dict(request.query_params))
|
||||||
if not valid:
|
if not valid:
|
||||||
raise HTTPException(status_code=404, detail="We can't verify that you have Steam profile.")
|
raise HTTPException(status_code=404, detail="We can't verify that you have Steam profile.")
|
||||||
url = client.get_oauth_url()
|
url = client.get_oauth_url()
|
||||||
response.set_cookie(key="steam_id", value=encrypt(request.query_params.get("openid.claimed_id")), max_age=300)
|
response.set_cookie(key="steam_id", value=encrypt(request.query_params.get("openid.claimed_id")), max_age=300)
|
||||||
return RedirectResponse(url=url)
|
return RedirectResponse(url=url)
|
||||||
|
|
||||||
async def validate(data: dict):
|
async def validate(data: dict) -> bool:
|
||||||
base = "https://steamcommunity.com/openid/login"
|
base = "https://steamcommunity.com/openid/login"
|
||||||
params = {
|
params = {
|
||||||
"openid.assoc_handle": data["openid.assoc_handle"],
|
"openid.assoc_handle": data["openid.assoc_handle"],
|
||||||
|
|
Reference in a new issue