Is there an function to modify a user custom field?

I added my custom field via the config, generated the schema, all good. I can't seem to find a way to update the contents of the user custom field via the better auth library. I'd understand if that's not a feature that's offered, though it would be convenient to use their client side instance and not have to create a server endpoint and check their privileges. Just want to make sure I'm not missing something.
4 Replies
ddev
ddev2mo ago
Hi @Eric What do you mean "update" a custom field? If you mean something like upadate data in your DB for that field - there is probably nothing built in in better auth. I created a separate function which update a field by user id (in my case lang field in DB)
Eric
EricOP2mo ago
Yes, I mean update the contents of that field, same as you can update the name or email via the library, it would be nice to be able to update the custom fields as well, since to do it on your own you have to authenticate the user session
ddev
ddev2mo ago
i am not familiar with your case, but in my case i update a preferred lang of the user based on user's browser locale so i use a custom update function on after hook of better auth, maybe that would help you
Eric
EricOP2mo ago
I know how to implement it modifying the db directly, I just wanted to make sure the library didn't offer it since it has the ability to add the custom fields, seesm strange

Did you find this page helpful?