Kaylee
Kaylee
Explore posts from servers
BABetter Auth
Created by Kaylee on 2/26/2025 in #help
Creating an org at user creation best practices
The docs does suggest to query the DB to add the organizationId to the session https://www.better-auth.com/docs/plugins/organization#set-active-organization But yea i should probably split the logic out, the org creation for user.create & active org to session.create
8 replies
BABetter Auth
Created by Kaylee on 2/26/2025 in #help
Creating an org at user creation best practices
My current working implementation is a session.create.before database hook I then do some db queries to check if the user is in an organization if they are, add the first organization id to the session's activeOrganizationId Otherwise insert a new organization, add the user as an owner & then add the org id to the sessions activeOrganizationId I am not sure if user,create.after finishes before session.create.before so i just did it inside session.create.before to be safe
8 replies