将用户模型名称从User更改为XYZUser时,Prisma nextauth不工作

oaxa6hgo  于 2023-04-20  发布在  其他
关注(0)|答案(1)|浏览(128)

situation - building using nextjs - next-auth - prisma adapter and supabase for user auth. the application auth works fine when my db prisma model was called User. however since changing model name from User to WebUser it ain't longer works and I get an error from next-auth 'GetUserByEmailError'. as soon as I update the migration and change it back to User I can then register/login. Have anyone had this issue/知道在集成next-auth时是否可以为用户使用不同的数据库模型名称吗?
先谢了

yrefmtwq

yrefmtwq1#

当使用Prisma适配器时,您可以在公共模式上创建一个名为User的表:https://authjs.dev/reference/adapter/prisma#create-the-prisma-schema-from-scratch
使用Supabase时,您也可以使用Supabase Adapter,它将使用一个名为next_auth的单独架构:https://authjs.dev/reference/adapter/supabase
这也使得使用RLS更容易:https://authjs.dev/reference/adapter/supabase#enabling-row-level-security-rls

相关问题