How to handle niche case with multi-tenant
I am currently running better-auth at
app.domain.com
this is the place where my users can have their dashboard, and so I authenticate them (email/pass, google and github) and I use better-auth for that (so my BASE_URL of better auth is: app.domain.com
).
Each user can create its own example.domain.com
, at this site the I need to authenticate the visitors of my user's site, with only magic link, google and github.
So, I think, I cannot use better-auth for that, and TBH I have no idea on how to handle this situation, any ideas? Ik it's not completely related to better auth, but probably there's already something built-in to handle this situation that I cannot found.
Thank to y'all! ❤️ for the amazing package
P.S. I read all the doc of Admin and Organization, but I realized that it's not probably what I am looking for.2 Replies
Hello. Were you able to figure this out?
Hi I didnt manage to implement it yet, since I am doing other stuffs, but my I have couple of ideas:
- do it on my own, implement magic link, google and github signin custom, without better auth, only for
*.domain.com
.
- create a second auth configuration. What I mean by that is to actually create a new auth.visitors.ts
and auth-client.visitors.ts
, add the routes to my *.domain.com
and ofc create separates tables (and remap the default one to my "custom visitors" one in the auth.visitors.ts
). In my case they are two different apps, they dont need to share sessions between them so it's okay for me.
Ofc. I also need to add the tenantId
to the better auth tables