import { withAuth } from "next-auth/middleware"; export default withAuth( // `withAuth` augments your `Request` with the user's token. function middleware(req) {}, ); export const config = { // https://nextjs.org/docs/app/building-your-application/routing/middleware#matcher matcher: [ /* * Match all request paths except for the ones starting with: * - api (API routes) * - _next/static (static files) * - _next/image (image optimization files) * - favicon.ico (favicon file) */ "/((?!api|_next/static|_next/image|favicon.ico|auth/|access-denied).*)", ], };