Next.js Discord

Discord Forum

Best way to manage user session

Unanswered
American English Coonhound posted this in #help-forum
Open in Discord
American English CoonhoundOP
Hi im currently using Better Auth + Prisma for authetnication+user session . However since my navbar requrirs to use authClient.useSession() to check if user is logged in and retrieve their username, it takes like 2-3 seconds eveyrtime i refresh the website. Is it better to just store the user info in a state (useState) or are there better ways?

1 Reply

@American English Coonhound Hi im currently using Better Auth + Prisma for authetnication+user session . However since my navbar requrirs to use authClient.useSession() to check if user is logged in and retrieve their username, it takes like 2-3 seconds eveyrtime i refresh the website. Is it better to just store the user info in a state (useState) or are there better ways?
Im not well versed with betterauth (or any client-side auth solution in that regards). but auth doesn't need to be this complicated. you can always use the nextjs server to manage authentication and quickly check sessions without ever touching the db and wait for 2-3 seconds.