KindeK
Kinde16mo ago
5 replies
conkyyy

How to add subdomain auth flow for a multi tenant app?

I already tried setting the KINDE_COOKIE_DOMAIN=.localhost

Here's my .env

KINDE_CLIENT_ID=
KINDE_CLIENT_SECRET=
KINDE_ISSUER_URL=
KINDE_SITE_URL=http://app.localhost:3000
KINDE_POST_LOGOUT_REDIRECT_URL=http://app.localhost:3000/login
KINDE_POST_LOGIN_REDIRECT_URL=http://app.localhost:3000/login
KINDE_M2M_ID=
KINDE_M2M_SECRET=
KINDE_ORG_CODE=
KINDE_COOKIE_DOMAIN=.localhost

I am using the following for both sign up/login flows from app.localhost and {subdomain}.localhost

import { RegisterLink, LoginLink } from "@kinde-oss/kinde-auth-nextjs/server";

When I removed KINDE_COOKIE_DOMAIN, the app.localhost:300/login works properly, but when I add it, I can't sign in and I get logged out as soon as I register.
Was this page helpful?