tormentor
tormentor
BABetter Auth
Created by Priyansh on 5/22/2025 in #help
How to use better auth to only allow specific email and pswd to access the dashboard?
You can use middleware in nextjs to check every request coming to dashboard. Then you can implement user.role from admin plugin.
3 replies
BABetter Auth
Created by Esscraye on 5/19/2025 in #help
migrate after docker build
Before migrating, there’s generating the schema. Use that schema sql to migrate
4 replies
BABetter Auth
Created by Esscraye on 5/19/2025 in #help
migrate after docker build
If you have correctly updated the database type, it would generate the sql migration file which is a plain sql you can query it in the database.
4 replies
BABetter Auth
Created by San on 5/17/2025 in #help
unable_to_create_user error
Yeah. that is the worst part of this database integrations. the types that better-auth expects and the types the fields in the table initialize is completely different. So you have to manually scope the fields to what the better-auth expects. Those details will be given as warnings when you try to migrate. These details are specific to databases, so it might differ. try exactly giving the field types what better-auth expects to the fields you have given in prisma (database specific). it takes some couple of tries but you will get it.
28 replies
BABetter Auth
Created by San on 5/17/2025 in #help
unable_to_create_user error
better-auth generate might have warned you of this while you generated the scripts. See if you see any warnings when you do generate or migrate.
28 replies
BABetter Auth
Created by San on 5/17/2025 in #help
unable_to_create_user error
The primary error is because of the emailVerified field. better-auth expects the emailVerified to be a boolean while you have given it to be DateTime, change it to boolean and then generate and then migrate.
28 replies
BABetter Auth
Created by San on 5/17/2025 in #help
unable_to_create_user error
Seems like either you didn't generate the schema well (maybe some of the fields might have mapped to a different field type than what's expected by better-auth) or you didn't migrate your generated schema. Try doing one of those. Check if all the field types in the existing db match the one listed in the schema. if any of the field you have added, that should be added in the user object while instantiating better-auth https://www.better-auth.com/docs/concepts/database https://www.better-auth.com/docs/concepts/typescript#additional-fields
28 replies