KindeK
Kinde12mo ago
hendry.lim

getUser returns null when Using Kinde and Vercel Multitenancy

Hi, i am using Vercel's multitenancy architecture. I am able to successfully protect my pages at root (eg app.localhost:3000, app.localhost:3000/account etc). however, when i navigate to my subdomains (eg. demo.localhost:3000, xyz.localhost:3000/account), kinde's getUser from getKindeServerSession returns user null even though the user is logged in which i verified when I go to app.localhost:3000. anyone can point me to where i did wrong and how can i resolve this? thanks

const DomainPage = async ({ params }: Props) => {
  const { domain, slug } = await params;
  const decodedDomain = decodeURIComponent(domain); // xyz.localhost:3000
  const decodedSlug = decodeURIComponent(slug); // account

  const { getOrganization, getPermissions, getUser } = getKindeServerSession();
  const user = await getUser();  // null when at xyz.localhost:3000/account
  const organization = await getOrganization(); // null
  const permissions = await getPermissions(); // null

  return ( ... )
}
Was this page helpful?