user.email not working
giving me this error: Property 'email' does not exist on type 'Promise<KindeUser | null>'.
5 Replies
Thanks @Thomas getting the team to look into this for you
Thanks
@Thomas are you able to update to use this?
import { getKindeServerSession } from "@kinde-oss/kinde-auth-nextjs/server";
export default async function Dashboard() {
const { getUser } = getKindeServerSession();
const user = await getUser();
return (
<main>
{user && (
<div>
<div>{user?.email}</div>
</div>
)}
</main>
);
}
The short answer is that your default function should be async
and you have to await getUser()
It worked
thank you very much!
Yay! Thats awesome the hear!