Multiple usage of same plugin?

Is it possible to use the organization() plugin multiple times? My use case: Centralized login for multiple different portals using better-auth: user (mobile app), business (web app), enterprise (web app). logins are all centralized in 1 better-auth db, and we use middleware with extra custom field to check if user has access to user, or business, or enterprise, or all. i would like for business accounts to be able to create their own organizations, but i would also like for enterprise accounts to be able to create their own organizations, with different roles and without conflict to each other. is that possible? I assume i would need to use the organization() plugin twice so i have 2 instances? or should i do my own custom organization solution instead. thank you
Solution:
Maybe add extend the field for organisation table to have a field for type like enterprise, standard and then add some extra logic to check what the org type is
Jump to solution
4 Replies
lonelyplanet
lonelyplanet2w ago
I don't believe that would be possible as they would both change the schema of the db for example that would both want to try to edit the same table
Solution
lonelyplanet
lonelyplanet2w ago
Maybe add extend the field for organisation table to have a field for type like enterprise, standard and then add some extra logic to check what the org type is
lonelyplanet
lonelyplanet2w ago
when running things
Nicky Dicky
Nicky DickyOP2w ago
good solution! thank you

Did you find this page helpful?