Get user inside session hook

Is there a way to get the userinfo inside a before session databaseHook?
I can't call auth.api.getSession and then read the user object as its in the initialization of auth.

My goal is to automatically set the active org based on the email domain.

export const auth = betterAuth({
    
    databaseHooks: {
        session: {
            create: {
                before: async (session) => {
                    const email = user.email
                    const orgs = orgs
                    const user_org = some logic to find the correct org based on email 
                    return {
                        data: {
                            ...session,
                            activeOrganizationId: user_org.id
                        }
                    }
                }
            }
        }
    }
});
Was this page helpful?