Fei XiangF
Convex Community17mo ago
1 reply
Fei Xiang

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
Was this page helpful?