fix: cookie timeout problem
This commit is contained in:
parent
84185ad51c
commit
e9630d8988
1 changed files with 2 additions and 2 deletions
4
app.py
4
app.py
|
@ -69,7 +69,7 @@ async def setup(request: Request, response: Response):
|
||||||
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=1800)
|
||||||
return RedirectResponse(url=url)
|
return RedirectResponse(url=url)
|
||||||
|
|
||||||
async def validate(data: dict) -> bool:
|
async def validate(data: dict) -> bool:
|
||||||
|
@ -94,7 +94,7 @@ async def validate(data: dict) -> bool:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@app.get('/callback/discord')
|
@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)
|
token = await client.get_access_token(code)
|
||||||
user = await client.fetch_user(token)
|
user = await client.fetch_user(token)
|
||||||
|
|
||||||
|
|
Reference in a new issue