Dynamic Redirect on SvelteKit Multi-tenant App
Hey! We're building a multi-tenant app so I'm trying to redirect the user to the appropriate custom domain (and/or subdomain) after signing in.
For context imagine Substack or beehiiv. I'm trying to sign in the users of our tenants into the tenant's app they launched through us.
I tried using the code below to redirect the user to tenant's subdomain. But it's still redirecting me to the KINDE_REDIRECT_URL set in the .env
I tried changing the KINDE_REDIRECT_URL to subdomain.localhost:5175 and it worked as expected.
How do I make it dynamic?
Also, currently, Tenant Organizations have their employees as members. Should I also put their Users on signup in their organizations and give them a subscriber role? Or track that separately?
Thank you for your help!
For context imagine Substack or beehiiv. I'm trying to sign in the users of our tenants into the tenant's app they launched through us.
I tried using the code below to redirect the user to tenant's subdomain. But it's still redirecting me to the KINDE_REDIRECT_URL set in the .env
I tried changing the KINDE_REDIRECT_URL to subdomain.localhost:5175 and it worked as expected.
How do I make it dynamic?
Also, currently, Tenant Organizations have their employees as members. Should I also put their Users on signup in their organizations and give them a subscriber role? Or track that separately?
Thank you for your help!