Database Hooks within a Plugin

Hi,

I'm working on a custom plugin which requires intercepting and editing the user data when a user is created. This would be easier with a database hook, but I cannot find a way to do a database hook in a plugin. Is there a way of doing this?

Thanks.
Solution
you can pass init
const plugin = {
  init: (ctx)=>{
    return {
      context: {
        databaseHooks: {} //
      }
    }
  }
} satisfies BetterAuthPlugin;
Was this page helpful?