What are the differences between User vs Account?
I'm integrating Better Auth into my SaaS for authentication, but these 2 terms make me confused. Is User the actual user in my system (registered via my authentication mechanism) and Account is similar to Customer in other payment platform (the link between my system and the payment platform) ?
9 Replies
User is often more public facing info, account would contain additional and more private information about a user, such as their password, what provider they used to sign in with oauth, and other details
So they are 1:1 in relation, right?
Yes kind of, a user can also have multiple accounts. One could be for credentials so passwords, and the other could be social sign on account, but both linked to the same user
Every account has a field called
userId
that links to a user.so now if I need to integrate my system with a payment processing service (like Polar for example), should I link the Polar's customer with User or Account?
You can do something like this. You add the customer id on user:

And then a subscription table if you need to track:

This is from our Stripe plugin.
By the way, not sure if you're aware, but there is a Polar plugin.
yeah I know about the better-auth polar plugin, I also check the code here https://github.com/polarsource/polar-adapters/tree/main/packages/polar-betterauth but I can't see anything related to the database design for the customerId field, so I need to ask to be sure
GitHub
polar-adapters/packages/polar-betterauth at main · polarsource/pol...
Dead simple Checkout and Payment Integrations. Contribute to polarsource/polar-adapters development by creating an account on GitHub.
Yeah it doesn't look like the Polar plugin extends your DB