WorkOS session stays valid, but <Authenticated> / useConvexAuth becomes unauthenticated until reload
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
