Overriding defaults to handle Team or Account based multi tenancy via url parameter #1282
Unanswered
raholland79
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am developing a company/team based multi tenant application with nextjs. I've been reading the docs , specifically the various ways to override defaults but I can't quite work out a solution to my problem.
A user will sign their company up with an initial admin user and add any other company users. I have an
Account
model that stores a url slug for the company with a unique id and aUser
model that has the hashed password/email and stores the account_id. To login we pull the account from the url parameter and with prisma:account = await prisma.account.findUnique({where: slug})
user = account.users.find(...etc)
so
Account -> users
next-auth expects my Account to be a part of the individual user and I can't work out how to support my use case. Almost seems like I should have a Company that has many account/users ?
Also I see that I can use callbacks and pages - and I can override the signin procedure to check the account but I can't work out how to get the url param - can the pages option do something like
signin: '/pages/[account]/signin
?Beta Was this translation helpful? Give feedback.
All reactions