How to generate a custom userID on registration
Can I provide a custom ID when a user signs up? (or ideally call a custom endpoint so that my database generates it naturally)
context: my database uses a custom primary key type
13 Replies
create database hook
user : { before : { } }
you 100% certain this works? I tried this a couple of months ago using async and it didn't work
it will work
Database | Better Auth
Learn how to use a database with Better Auth.
id =
uXWITtFBL9DqdebtBfUn3tgZ4JIhjVdv
in my database@Geospace What version are you on?
it should work on latest
ah i'm on 1.2.7, i assumed because that github issue was still open it hadn't been completed yet
Can you link me that issue?
GitHub
feat(generateId): support async id generator by ping-maxwell · Pul...
Adds support for async on generateId.
Additional Context:
https://discord.com/channels/1288403910284935179/1288403910284935182/1369244733116911636
My PR is specifically for adding
async
on the generateId function, that function already exists (https://www.better-auth.com/docs/reference/options#advanced)yeah the async part is what I was stuck on iirc