1
0

fix: cookie timeout problem

This commit is contained in:
オスカー、 2023-03-22 14:30:08 +00:00 committed by GitHub
parent 84185ad51c
commit e9630d8988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
app.py
View File

@ -69,7 +69,7 @@ async def setup(request: Request, response: Response):
if not valid:
raise HTTPException(status_code=404, detail="We can't verify that you have Steam profile.")
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=1800)
return RedirectResponse(url=url)
async def validate(data: dict) -> bool:
@ -94,7 +94,7 @@ async def validate(data: dict) -> bool:
return False
@app.get('/callback/discord')
async def update_metadata(response: Response, code: str, steam_id: Cookie()):
async def update_metadata(response: Response, code: str, steam_id: str = Cookie()):
token = await client.get_access_token(code)
user = await client.fetch_user(token)