79483698

Date: 2025-03-04 12:30:09
Score: 1
Natty:
Report link

Issue resolved by moving jwt and session callbacks inside auth.config.ts file above authorized function in callbacks object. Can someone maybe explain why providers were working but callbacks didn't inside auth.ts? Is it maybe that session callback needs to be provided to middleware? This is my middleware.ts:

import NextAuth from 'next-auth';
import { authConfig } from './auth.config';

export default NextAuth(authConfig).auth;

export const config = {
// https://nextjs.org/docs/app/building-your- 
application/routing/middleware#matcher
matcher: ['/((?!api|_next/static|_next/image|.*\\.png$).*)'],
};
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Luka Bugarin