Nextauth google login not creating registers
Hey, I am having an issue with the Google login/signup on nextauth, the GoogleProvider is not creating the register in my database somehow and I don't know what is happening, the user can login and I recieve the sessionData but there is no new register in the databse when using google credentials. Has anyone had this before? I am using a T3 app so I should have everything setup right?
6 Replies
I would provide some of your config, and implementation code if possible.
Sure, thisis my server/auth.ts file
@auth/prisma-adapter | Auth.js
Official Prisma adapter for Auth.js / NextAuth.js.
and my scgema.prisma
this should help you
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@index([userId])
}
model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index([userId])
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
password String?
accounts Account[]
sessions Session[]
printers Printer[]
worksAsClient Work[] @relation("ClientRelation")
worksAsWorker Work[] @relation("WorkerRelation")
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}
I get an type error when trying to add the prismaAdapter, otherwise it is the same that I have
The google provider should create user registers in my database by itself right?
Solved it, thank you so much @shreyashrangrej it actually helped a lot
If anyone in the future needs it: