V. *_*omi 5 javascript keycloak prisma next-auth
我正在使用 next-auth 的 keycloak 适配器,并使用默认设置来保存 keycloak 使用 Prisma orm 对数据库的响应。
\n问题是 keycloak 的响应(即 next-auth 中的 account 变量)有一个键值字段not-before-policy。
\n data: {\n provider: \'keycloak\',\n type: \'oauth\',\n providerAccountId: \'\', \n access_token: \'..--P0Y19Ee-TKh47w\', \n expires_at: 1636469568,\n refresh_expires_in: 1800,\n refresh_token: \'fasdfsf\',\n token_type: \'Bearer\',\n id_token: \'fsdfA8HL85zFsekhgp1F0g\',\n \'not-before-policy\': 1636367915, <-----------------------------------------------------\n session_state: \'b11fe259-961f-49c3-b1b6-27ff8b22d94c\', \n scope: \'openid email profile\',\n userId: \'ckvs7jszn0006qck9qnajrqan\'\n }\n
Run Code Online (Sandbox Code Playgroud)\n字符“-”(破折号)阻止我在 Prisma 架构上定义帐户模型中的字段。
\nnot-before-policy Int\n
Run Code Online (Sandbox Code Playgroud)\n根据Github上的这个问题和文档中的这个主题,这个问题已经解决。
\n我试图通过在帐户模型中执行类似的操作来映射此值(使用“非法”字符)。
\n not_before_policy Int @map("not-before-policy") // THIS doesn\'t work!\n
Run Code Online (Sandbox Code Playgroud)\n这也不起作用并给我错误:
\n 1\n 17 updateUser: (data) => p.user.update({ where: { id: data.id }, data }),\n 18 deleteUser: (id) => p.user.delete({ where: { id } }),\n\xe2\x86\x92 19 linkAccount: (data) => p.account.create({\n data: {\n provider: \'keycloak\',\n type: \'oauth\',\n providerAccountId: \'\', \n access_token: \'..--P0Y19Ee-TKh47w\', \n expires_at: 1636469568,\n refresh_expires_in: 1800,\n refresh_token: \'fasdfsf\',\n token_type: \'Bearer\',\n id_token: \'fsdfA8HL85zFsekhgp1F0g\',\n \'not-before-policy\': 1636367915, \n session_state: \'b11fe259-961f-49c3-b1b6-27ff8b22d94c\', \n scope: \'openid email profile\',\n userId: \'ckvs7jszn0006qck9qnajrqan\'\n }\n})\n\nUnknown arg not-before-policy in data.not-before-policy for type AccountUncheckedCreateInput. Did you mean not_before_policy? Available args:\ntype AccountUncheckedCreateInput {\n id?: String\n userId: String\n type: String\n not_before_policy?: Int | Null\n provider: String\n providerAccountId: String\n refresh_token?: String | Null\n access_token?: String | Null\n expires_at?: Int | Null\n token_type?: String | Null\n scope?: String | Null\n id_token?: String | Null\n session_state?: String | Null\n oauth_token_secret?: String | Null\n oauth_token?: String | Null\n refresh_expires_in?: Int | Null\n}\n
Run Code Online (Sandbox Code Playgroud)\n我可以让 prisma 以某种方式理解 keycloak 使用这个“非法”名称的响应吗?或者我可以在 next-auth 调用它之前改变具有 keycloak 响应的 next-auth 对象吗? prisma-adapter ?\n我是否错过了文档中的某些内容?
\n预先非常感谢您!
\n