Closed DevilWarrior closed 4 years ago
Hi, I currently have things setup where I use cookies with fastapi_login.
manager = LoginManager(SECRET, tokenUrl='/auth/token', use_cookie=True) manager.cookie_name = 'oversight_token'
On the auth route I build a response object with a RedirectResponse and set the cookie there.
access_token = manager.create_access_token( data=dict(sub=email) ) response = RedirectResponse(url='/bids') response.set_cookie( key=manager.cookie_name, value=f"Bearer {access_token}", httponly=True, max_age=2147483647, expires=2147483647, ) return response
This works only if the redirect has a POST method, does not work for GET routes. Is that the expected behavior? I'm new to fastapi, sorry for the noob question.
So you are saying you can only set the cookie if '/bids' has a POST method? That seems quite weird
'/bids'
After searching found this issue on the FastAPI repo which should solve your problem
Thank you!!!!
Hi, I currently have things setup where I use cookies with fastapi_login.
On the auth route I build a response object with a RedirectResponse and set the cookie there.
This works only if the redirect has a POST method, does not work for GET routes. Is that the expected behavior? I'm new to fastapi, sorry for the noob question.