I’m trying to implement a “Remember Me” feature using AshAuthentication in a Phoenix app. As I understand it, when a user logs in, AshAuthentication.Phoenix.Plug.store_in_session/2 stores the token in the session (cookies), and on subsequent visits, the subject (user) is loaded from that token.
In my current setup, the token lifetime is set to 14 days. What I want is:
If the user checks “Remember Me” at login, the token should keep its 14-day lifetime.
If the user does not check “Remember Me,” the session should last only for the current browser session, so the user gets logged out once the browser closes.
How can I achieve this behavior with AshAuthentication? Any advice or example configurations would be appreciated.