Integrate new table schema created using plugin with authentication
Hello, I have created new table schema using plugin, and now I would like to integrate and populate that table during authentication.
It might be the cas that I haven't seen required documentation on that, so link to that could also help.
Basically I have this TermsOfService table plugin:
and I have inserted this plugin in config:
Should I create hook for populating that table? If so should I create connection myself, or is there a way to do this using better-auth. Thanks!
5 Replies
Just use hooks!, after signin add a Row in the Database, im not to sure how you have set it up
but i believe you can add hooks inside the plugin itselft
Create your first plugin | Better Auth
A step-by-step guide to creating your first Better Auth plugin.
Yeah you can add these values manually, but I though it is possible to actuall use auth flow, upload those values using better-auth and not seperate connection to db. Since then what js ghe reason for adding new table schema using plugin
So you want to have a custom table? That when a user signs up it adds a custom row to this custom table but not use DB?
Better auth adapter has fixed methods of updating users you will need to use a db connection yourself even if you use the internaladapter it wont have a function to do this
Yeah that was my idea
But I guess I will change this architecture little bit
Thanks for clarification