Why I can't get current user's information if I've already logged in
export const viewer = query({
args: {},
handler: async (ctx) => {
const userId = await auth.getUserId(ctx);
return userId !== null ? ctx.db.get(userId) : null;
},
});
const currentUser = useQuery(api.current.viewer, {});
currentUser is always undefined
also
<Authenticated>
<Content />
</Authenticated>
<Unauthenticated>
<SignInForm />
</Unauthenticated>
My site always disply SignInForm I've already logged in
I checked the convex db, already updated auth tables and user table including authsession table and so on
1 Reply
https://docs.convex.dev/auth/debug might be helpful
Debugging Authentication | Convex Developer Hub
You have followed one of our authentication guides but something is not working.