Stuck in permanent unauthenticated state after access token expiry (AuthKit, Next.js)
* After the WorkOS access token expires, the next Convex queries that call
auth.getIdentity() throw.* AuthKit refreshes the token (verified in
useAccessToken()).* The Convex backend starts accepting the new token — new successful queries appear in the Convex dashboard.
* But on the client,
useConvexAuth() never recovers and stays:This permanently locks the UI out until a full page reload.
Things I tried:
* Official
ConvexProviderWithAuth example from the docs*
ConvexProviderWithAuthKit from @convex-dev/workos* Custom
useAuth integrations with stable refs and effectsAll end up with the same result: once Convex sees an error during the token-refresh window, its client auth state machine seems unable to transition back to authenticated (I think, I could only go so far in reading the source).
This feels related to the previously known
preloadQuery auth racehttps://github.com/get-convex/convex-backend/issues/242
Full reproducible issue:
https://github.com/get-convex/convex-backend/issues/259
