Convex + Clerk Auth

Giving convex + clerk + nextjs a combo as theo recently recommended. Running into auth issue where the client side is not in sync with the actual auth state. If you are in the convex server you can read here - but curious if anyone else has run into this or if I should just ignore this edge case? Server components protecting page using clerks auth function - redirect if already logged in. If a user has two tabs open, where both are initially on the sign in page, for example, and one tab logs in - when we switch to the other I'd expect to be redirected and logged in. That does not happen right now and I am not sure how to fix the client provider state for auth being out of sync? https://discord.com/channels/1019350475847499849/1386770377929130014
3 Replies
Perfect
PerfectOP2mo ago
If anyone got any ideas, would hugely appreciate it. Maybe this is a non-issue. Thanks
bythewayitsjosh
bythewayitsjosh2mo ago
I'm not as familiar with Clerk / Convex as maybe I need to be for a full answer, however it seems like the problem is something like Clerk returning an 'authenticated' state, but without the user information that normally comes with it in the second tab. I'm guessing maybe Convex only stores the authentiction state, not the current user info? I would maybe argue that this is such an edge case that it's not worth spending a huge amout of time on, unless you think your users are likely to be opening multiple tabs. At the end of the day a page refresh should solve the issue anyway, which would be most users immediate go-to I would say.

Did you find this page helpful?