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
The problem with this solution is that after a failed login attempt the sessionErrorKey get write into the session. In case the next login attempt is successfully, the error won't get removed from the session. I have also tried to manually call sesson.unset(authenticator.sessionErrorKey) but it didn't remove the key. So my question is how it should be done correctly?
It always helps to implement things on one's own, so the core concepts can be better understood. It's true that a session flash message gets unset after it gets read in the loader BUT there's one condition, which was not obvious for me after reading Remix docs: after reading flash message, one has to commit session: return json({...}, { headers: await commitSession(session) } } from the loader.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I have inroot.ts
loader more or less this logic to return user from the session:The problem with this solution is that after a failed login attempt thesessionErrorKey
get write into the session. In case the next login attempt is successfully, the error won't get removed from the session. I have also tried to manually callsesson.unset(authenticator.sessionErrorKey)
but it didn't remove the key. So my question is how it should be done correctly?Btw. I also use Remix-Auth-Socials.It always helps to implement things on one's own, so the core concepts can be better understood. It's true that a session flash message gets unset after it gets read in the loader BUT there's one condition, which was not obvious for me after reading Remix docs: after reading flash message, one has to commit session:
return json({...}, { headers: await commitSession(session) } }
from the loader.Beta Was this translation helpful? Give feedback.
All reactions