Gday folks, trying to investigate a multitenant implementation with NextJS. The idea is to provide each customer a subdomain, eg;
e297d6a3-9e0e-4b9b-a658-05acd3caf539.website.com
Which can later be changed to a.website.com if the user would like.
I'd like to support the concept that registered users may be a part of more than one subdomain. For example:
a.website.com
and
b.website.com
So if the user accesses a.website.com/auth, it allows them to login if they were added by an administrator to the backend.
Similarly, if they tried to access b.website.com/auth, it'd allow them to login.
However if they tried to login to c.website.com, a website they're not a part of, it would not let them in.
I took a look at the examples you have on Github but this part kind of ruled it out unless I am misunderstanding:
the subdomain for each user is extracted from their email provider, ex. for user@abc.com, abc would be the subdomain.
As in this case, they may be using example@gmail.com, which would have access to a.website.com and b.website.com, instead of gmail.website.com