Syntax error: Support for the experimental syntax 'decorators-legacy' isn't currently enabled:
Anyone with experience with next-auth?
Got a problem with configuring the signIn callback. I need to check if the user has the role Admin before letting them access my application, if they are just a regular user I want to redirect them to the an error page.
It works fine with redirecting them when user lacks the role admin, but when I as the documentation says return a Promise with true when the user is a admin, nextjs just keeps redirecting to my oauth2 server for login agin. Any suggestions?
callbacks: {
signIn: async (_user, _account, profile: IWorklyProfile) => {
const isSomeKindOfAdmin =
profile[ROLE_PATH].includes(Role.PartnerAdmin) ||
profile[ROLE_PATH].includes(Role.CustomerAdmin);
if (!isSomeKindOfAdmin) {
return Promise.reject(new Error('Invalid access'));
}
return Promise.resolve(true);
}
}
Hey all, I've been having a tedious issue in my project since migrating to absolute paths in my application. Auto imports are no longer working, but my tsconfig file seems to look fine:
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@/*": ["./*"]
},
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"noUnusedLocals": true,
"noUnusedParameters": true,
"strictNullChecks": true,
"noImplicitAny": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": [
"next-env.d.ts",
"**/*.ts",
"**/*.tsx"
],
"exclude": [
"node_modules"
]
}
I've tried changing "typescript.preferences.importModuleSpecifier": "non-relative"
to both non-relative
and auto
but auto imports still fail to work.
I'm getting the same behaviour in VSCode and Nvim so I'm most likely missing something in my tsconfig