Is it possible to change cookie settings on certain requests? #226
-
|
I'm implementing some OAuth logins with To get around this, one can add an intermediary redirect in the redirect chain that hits a page that has a However, that "instant" redirect isn't very instant and feels a bit hacky. So what I was hoping to do was set the cookie to Or, if there's a better way to accomplish this I'd love to know! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Setting SameSite to Lax is generally the easiest approach. Currently there is no way to dynamically reconfigure SameSite as the cookie service is running. |
Beta Was this translation helpful? Give feedback.
-
|
When I implemented OAuth login with Discord (in Python land, mind you) the solution I went with here was having two session cookies. One is Lax, one is Strict. Each one has its own isolated session store. We use the Lax session when redirecting to Discord and back, and then upon getting the token, immediately drop the Lax session and store the current user info in the Strict session. Unfortunately I don't think you can do that out-of-the-box with tower-sessions and axum… |
Beta Was this translation helpful? Give feedback.
Setting SameSite to Lax is generally the easiest approach.
Currently there is no way to dynamically reconfigure SameSite as the cookie service is running.