-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
adaptersChanges related to the core code concerning database adaptersChanges related to the core code concerning database adaptersprisma@auth/prisma-adapter@auth/prisma-adapterstaleDid not receive any activity for 60 daysDid not receive any activity for 60 days
Description
Title
User Creation fails when using Keyclaok provider, cause of 'account' response field name -> not-before-policy
How to reproduce ☕️
On Basic Next-Auth project config just:
const prisma = new PrismaClient();
export default NextAuth({
adapter: PrismaAdapter(prisma),
providers: [
KeycloakProvider({
clientId: "myclient",
clientSecret: "...",
issuer: "...",
}),
],
});
Using the schema (almost the default one):
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Account {
id String @id @default(cuid())
userId String
type String
not_before_policy Int @map("not-before-policy") // THIS doesn't work!
provider String
providerAccountId String
refresh_token String?
access_token String?
expires_at Int?
token_type String?
scope String?
id_token String?
session_state String?
oauth_token_secret String?
oauth_token String?
refresh_expires_in Int?
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
}
model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
}
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}
Your question/bug report 📓
When I try to login
I getting the following Error when trying to update account table..
1
17 updateUser: (data) => p.user.update({ where: { id: data.id }, data }),
18 deleteUser: (id) => p.user.delete({ where: { id } }),
→ 19 linkAccount: (data) => p.account.create({
data: {
provider: 'keycloak',
type: 'oauth',
providerAccountId: '',
access_token: '..--P0Y19Ee-TKh47w',
expires_at: 1636469568,
refresh_expires_in: 1800,
refresh_token: 'fasdfsf',
token_type: 'Bearer',
id_token: 'fsdfA8HL85zFsekhgp1F0g',
'not-before-policy': 1636367915,
session_state: 'b11fe259-961f-49c3-b1b6-27ff8b22d94c',
scope: 'openid email profile',
userId: 'ckvs7jszn0006qck9qnajrqan'
}
})
Unknown arg not-before-policy in data.not-before-policy for type AccountUncheckedCreateInput. Did you mean not_before_policy? Available args:
type AccountUncheckedCreateInput {
id?: String
userId: String
type: String
not_before_policy?: Int | Null
provider: String
providerAccountId: String
refresh_token?: String | Null
access_token?: String | Null
expires_at?: Int | Null
token_type?: String | Null
scope?: String | Null
id_token?: String | Null
session_state?: String | Null
oauth_token_secret?: String | Null
oauth_token?: String | Null
refresh_expires_in?: Int | Null
}
I can't create a field not-before-policy, cause it has - (dashes) in its name.
Is there a work around, or at least if i could mutate the account object so i will change the key not-before-policy to something acceptable like not_before_policy?
Thank you
Contributing 🙌🏽
No, I'm afraid I cannot help regarding this
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
adaptersChanges related to the core code concerning database adaptersChanges related to the core code concerning database adaptersprisma@auth/prisma-adapter@auth/prisma-adapterstaleDid not receive any activity for 60 daysDid not receive any activity for 60 days