Fei Xiang
CCConvex Community
•Created by Fei Xiang on 9/16/2024 in #support-community
Why I can't get current logged in user information
5 replies
CCConvex Community
•Created by Fei Xiang on 9/16/2024 in #support-community
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
2 replies
CCConvex Community
•Created by Fei Xiang on 9/16/2024 in #support-community
How can I save additional user information like role "vendor" or "customer" in user table when using
How can I save additional user information like role "vendor" or "customer" in user table when using convex google Auth
Google({
profile(res, tokens) {
console.info({ res, tokens });
return {
id: res.sub,
balance: '0',
fullname: res.name,
email: res.email,
type: res.customer,
};
},
}),
onClick={() =>
signIn('google',
{customer: 'vender'}
})
}
As you can see, customer is not default property of google profile....
I tried like this but can received addtional info
please provide me with guidance?
7 replies