You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When setting a cookie and redirecting the user to a new page, you cannot read that cookie value on the page you are redirected to when single-flight-mutations are enabled (i.e. by default).
Expected behavior 🤔
I would expect single-flight-mutation to be indistinguishable from regular redirects, so the cookie can be read on the new page.
Notice the cookie has been set in browser developer tools
Click the login button again
Now you are logged in
Context 🔦
I want to implement a fairly simple cookie based auth, and so I need to set an auth cookie in the login action and then read it on all other pages to verify the user is authenticated.
I ran into this same problem, and I found a hacky workaround by digging into h3 internals. In the same place where I set the Set-Cookie header, I add the cookie to the current request like this.
I'd love to know if there is a better way, or if the approach has issues, but I'm handling protected routes exactly like in the reproduction repo, and this seems to work for now.
Duplicates
Latest version
Current behavior 😯
When setting a cookie and redirecting the user to a new page, you cannot read that cookie value on the page you are redirected to when single-flight-mutations are enabled (i.e. by default).
Expected behavior 🤔
I would expect single-flight-mutation to be indistinguishable from regular redirects, so the cookie can be read on the new page.
Steps to reproduce 🕹
Steps:
Context 🔦
I want to implement a fairly simple cookie based auth, and so I need to set an auth cookie in the login action and then read it on all other pages to verify the user is authenticated.
Your environment 🌎
The text was updated successfully, but these errors were encountered: