Gday folks, trying to investigate a multitenant im...
# support-questions-legacy
g
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:
Copy code
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
Just realised I never really asked a question. How would you recommend implementing this solution? Have I missed the plot? Based on the current business case, it's highly likely the same user may be added to several subdomains.
r
Hey @Gnarusly
That’s certainly possible. You just have to define a way for the backend to know which sub domain that user has access to. In the example app, the sub domain they have access to is identified by the email (as the example describes), but you could change to check a list somewhere.
Or you could modify each email in the sign in override on the backend to add the sub domain to it like user@example.com would become user+subdomain@example.com
4 Views