lukas
lukas
BABetter Auth
Created by lukas on 4/5/2025 in #help
Session cookie not refreshing
I'm using Next.js Pages Router. Login works fine. Session gets updated on server when it's supposed to, pushing back the expiresAt. But the response headers for all the later requests don't include the session cookie, so it expires and gets removed. I've tried calling authClient.getSession to try to manually refresh the session - returned 200 but didn't include the session cookie in the response headers either. I'm not using the customSession plugin. Any ideas?
7 replies
BABetter Auth
Created by lukas on 3/24/2025 in #help
Dealing with session expiration in a React app
I need to have the UI reflect the logged in state at all times. useSession will not trigger if a session expires (see: https://discord.com/channels/1288403910284935179/1353810672458403920/1353820038154551469) I'm trying to figure out how to deal with this, here's my current plan: 1. Store the current session in a React context. Keep it updated for sign in / sign out via useSession. 2. When I get a 401 back from my server, that probably means the session has expired, call getSession and update the context. Anyone have a better idea? (tagging this with Next.js but I think it should apply to all React apps)
13 replies
BABetter Auth
Created by lukas on 3/19/2025 in #help
Re-sending verification link after verification token expires
What's the correct pattern to allow re-sending a verification link if the user waits until after the verification token has expired to click the verification link? (1) - UX pattern - I could check the query string for error=token_expired and provide some UI where they can enter the email address they signed up with to get a new verification link sent to them. Is there a better UX here? (2) - generating verification token - not sure how to generate the token that sendVerificationEmail expects (I know that attempting to log in before your email is verified will send a verification email, but I'd rather just let users enter their email address to get a new verification email, I don't see the need for a password here)
5 replies