What would be a proper middleware to protect the pages /admin if the user does not have a session? Is it correct the name of the file "_middleware.js" and what should I write inside that file to protect the route?
-pages
----admin
-----_middleware.js
-----index.js
_middleware.js
export { default } from "next-auth/middleware";
Gives the error:
[next-auth][error][NO_SECRET] https://next-auth.js.org/errors#no_secret
.env
SECRET_KEY="SECRET_KEY"
NEXTAUTH_URL = "http://localhost:3000"
NEXTAUTH_SECRET_KEY="SECRET_KEY"