app.prepare().then(() => // code there)
and start server with forever
library NODE_ENV=production node server.js
and it's working fine, but seems this is working in a wrong way - seems it's normal server like in dev mode - so it shouldn't be like that. (I see thunder icon on the right-bottom corner and I see all files which are same as in dev mode) Thank you for your help!
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);
}
}