initAuth0 auth0 上的 DeepPartial 错误 - nextjs + typescript
DeepPartial error on initAuth0 auth0 - nextjs + typescript
正在尝试在 nextjs 打字稿上实施 auth0。
但是在 initAuth0 上,我得到了低于深度部分的错误,
Argument of type '{ clientId: string; clientSecret: string; scope: string; domain: string; redirectUri: string; postLogoutRedirectUri: string; session: {}; }' is not assignable to parameter of type 'DeepPartial<Config>'.
Object literal may only specify known properties, but 'clientId' does not exist in type 'DeepPartial<Config>'. Did you mean to write 'clientID'?ts(2345)
initAuth0代码,
import { initAuth0 } from "@auth0/nextjs-auth0";
export default initAuth0({
clientId: process.env.AUTH0_CLIENT_ID,
clientSecret: process.env.AUTH0_CLIENT_SECRET,
scope: process.env.NEXT_PUBLIC_AUTH0_SCOPE || "openid profile",
domain: process.env.AUTH0_DOMAIN,
redirectUri:
process.env.NEXT_PUBLIC_REDIRECT_URI ||
"http://localhost:3000/api/callback",
postLogoutRedirectUri:
process.env.NEXT_PUBLIC_POST_LOGOUT_REDIRECT_URI ||
"http://localhost:3000/",
session: {
// cookieSecret: process.env.COOKIE_SECRET,
// cookieLifetime: Number(process.env.SESSION_COOKIE_LIFETIME) || 7200,
},
})
关键是最后一部分出错了,
Did you mean to write 'clientID'?
在你的配置对象中,你写了clientId
(注意小写d
),initAuth0接受的配置对象,然而,expects clientID
.
关于 TypeScript 最令人沮丧的事情之一就是霸道的错误消息。希望以后能改进。
正在尝试在 nextjs 打字稿上实施 auth0。 但是在 initAuth0 上,我得到了低于深度部分的错误,
Argument of type '{ clientId: string; clientSecret: string; scope: string; domain: string; redirectUri: string; postLogoutRedirectUri: string; session: {}; }' is not assignable to parameter of type 'DeepPartial<Config>'.
Object literal may only specify known properties, but 'clientId' does not exist in type 'DeepPartial<Config>'. Did you mean to write 'clientID'?ts(2345)
initAuth0代码,
import { initAuth0 } from "@auth0/nextjs-auth0";
export default initAuth0({
clientId: process.env.AUTH0_CLIENT_ID,
clientSecret: process.env.AUTH0_CLIENT_SECRET,
scope: process.env.NEXT_PUBLIC_AUTH0_SCOPE || "openid profile",
domain: process.env.AUTH0_DOMAIN,
redirectUri:
process.env.NEXT_PUBLIC_REDIRECT_URI ||
"http://localhost:3000/api/callback",
postLogoutRedirectUri:
process.env.NEXT_PUBLIC_POST_LOGOUT_REDIRECT_URI ||
"http://localhost:3000/",
session: {
// cookieSecret: process.env.COOKIE_SECRET,
// cookieLifetime: Number(process.env.SESSION_COOKIE_LIFETIME) || 7200,
},
})
关键是最后一部分出错了,
Did you mean to write 'clientID'?
在你的配置对象中,你写了clientId
(注意小写d
),initAuth0接受的配置对象,然而,expects clientID
.
关于 TypeScript 最令人沮丧的事情之一就是霸道的错误消息。希望以后能改进。