Me_Broke
Me_Broke2w ago

WorkOS session stays valid, but <Authenticated> / useConvexAuth becomes unauthenticated until reload

Description: I’m using Convex with Next.js and WorkOS following the [Convex + WorkOS setup guide]. Everything works correctly during initial login — useConvexAuth and <Authenticated> properly reflect the user’s authenticated state. However, if I leave a tab open and come back later: • WorkOS session is still valid (user doesn’t need to re-login). • But Convex becomes unauthenticated: <Authenticated> renders the unauthenticated state, and useConvexAuth reports no user. • The only way to fix it is to manually refresh the page, after which Convex auth syncs again. Since my app relies heavily on Convex auth state, this is a problem for the user experience. Steps to reproduce: 1. Set up Convex auth with WorkOS in a Next.js app (following Convex docs). 2. Log in successfully. 3. Leave the tab open for a while. 4. Return later — WorkOS still recognizes the session, but Convex auth is lost. Expected behavior: Convex auth state should automatically remain valid (or seamlessly re-sync) as long as WorkOS session is valid, without requiring a full page refresh. Environment: • Next.js version: 14 • convex/react version: 1.25.4 • Browser: chrome • WorkOS integration: Hosted UI
1 Reply
Convex Bot
Convex Bot2w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!

Did you find this page helpful?