fastapi-sessions
fastapi-sessions copied to clipboard
RedirectResponse, HtmlResponse
Don't work with RedirectResponse, HtmlResponse, because you can't add cookie to response (example: response.set_cookie(key="fakesession", value="fake-cookie-session-value")). Solution: set cookie.attach_to_response(response, session) after response.
Example:
response = templates.TemplateResponse("auth.html", {"request": request })
cookie.attach_to_response(response, session)
return response
Please add this info to instuction, i spent a few hours to figure it out.