Hey, is it possible to use the same SuperTokens co...
# general
o
Hey, is it possible to use the same SuperTokens core for 2 different sites eg. billing.mycoolsite.com and admin.mycoolsite.com
r
hey @Ollie.
o
Hey
r
yes this is possible. Do you want different login UIs for each of the sub domains? Do each of the sub domains have their own backend?
o
I was hoping to use the same backend (an express server) with different custom UI's
r
right. And if a user logs into one of the sub domains, their session remains specific to that sub domain?
o
If thats possible then yes
One sub domain is a client billing panel / store area and the other will be an admin/support agent dashboard.
r
this is possible yea. What you want to do is to set the website domain value on the backend to
mycoolsite.com
. On the frontend, the websiteDomain will be the current sub domain.
Which recipe are you using?
o
Well the client area will use Email and password + social and the admin side just email and password, but I can just use Email and social on both and not show the social buttons on the admin side
r
that works.
What you will need to do finally is to override the sendEmail function in emailDelivery config to change the domain of the reset password link based on the origin in the request header.
other than that, it should just work
o
@rp following on with this, is it possible to reject sign in for users on the admin subdomain if they don't have a role (but still allow them to sign into the billing subdomain)
r
yes. You can do this via overrides. Override the sign in recipe function and call the original impl first. If that succeeds, then check the request origin to see if its admin sub domain. If it is, and the user doesn't have the right role, then throw an error.
o
Perfect! Thanks for your help.
3 Views