When successRedirect is not set in authenticate call, session data is not saved. #172
tylermmorton
started this conversation in
General
Replies: 1 comment
-
This is an intended behavior, calling authenticate without a success redirects gives you back the user data as isAuthenticated and not a session object. Even if it returned a session, the only way to save it would be to add a Set-Cookie header to the response the user receives. Because without a success redirect you the developer are in charge of creating and returning or throwing a response you need to store the user in the session, commit it and add the Set-Cookie header. Finally, this is documented here https://github.com/sergiodxa/remix-auth#custom-redirect-url-based-on-the-user. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, firstly, great library and thank you for your work!
I ran into a situation that took me a while to debug. I couldn't figure out why my session cookie was not getting set after calling
authenticate
with my email/pass strategy. Turns out it was because I was capturing the session logic and callingredirect
manually.Not really a bug, but it did trip me up for a while. To me, even if
successRedirect
is not set, this should not change whether the session cookie logic is executed. See here: https://github.com/sergiodxa/remix-auth/blob/main/src/strategy.ts#L150Just thought I would share to spark discussion or for anyone in the same boat.
Beta Was this translation helpful? Give feedback.
All reactions