hi,
we are developing a multi tenant application which we intend to host in house.
main website would be used for initial user signup and and signin but after initial signin we would like to redirect our users to their private tenant which would be hosted under clientX.domain.com.
what is the best way to deal with authentication from this perspective? keep in mind that all ui’s will be developed in weweb using weweb integrations; right now we do supabase.
i know how a proxy works, i was asking how would it help in this situation. we basically need to move weweb’s “is_authenticated” from one subdomain to another.
I see, that won’t work. It’s not a WeWeb thing, but rather a browser thing. If you’re redirecting between domains, you could send the credentials via a query, but it’s very clunky and potentially not secure. I think you should handle auth per domain.
What you’re trying to do is not documented anywhere specifically within WeWeb. I think the simplest way would be to just not share the Auth between the pages, which in theory could be the default scenario.
I actually just started developing a multi tenant app myself this week. Though I decided against using WeWeb for this use case so I could use https://usebasejump.com/ with its components. Maybe you can take some inspiration from their docs.
You don’t want to send authentication via query as it would leave your user vulnerable to impersonation by simply sharing an URL, but you might be able to set the auth cookie for the sub-domain while still on the domain page (set Domain=.example.com with a dot prefix to apply to all sub-domains). I guess you would need control over the back-end to set cookies like that, or maybe you could do it with custom javascript on the auth workflow response.