import { withAuth } from "next-auth/middleware"; import getConfig from "next/config"; export default withAuth( () => { }, { pages: { signIn: `/login`, }, callbacks: { authorized: ({ token, req }) => { const { url, headers, } = req; return true; /* const { publicRuntimeConfig: { embedded }, } = getConfig(); if (embedded) { return true; } // check login page const parsedURL = new URL(url); if (parsedURL.pathname.startsWith('/login')) { return true; } // check session auth const authorizedDomains = ["redaranj.com", "digiresilience.org"]; const userDomain = token?.email?.toLowerCase().split("@").pop() ?? "unauthorized.net"; if (authorizedDomains.includes(userDomain)) { return true; } return false; */ }, } } );