Setup next-auth for a "group" with matcher
Answered
Swedish Lapphund posted this in #help-forum
Swedish LapphundOP
I current have in
/app/middleware.tsexport { default } from "next-auth/middleware"
export const config = { matcher: ["/company", "/admin", "/panel"] }Answered by Dwarf Crocodile
export { default } from "next-auth/middleware";
export const config = { matcher: ["/admin/:path*"] };if you want it go down with route
8 Replies
Swedish LapphundOP
these
company, panel and admin are basically each a portal of its own, they contain their own dashboard. But these 3 groups, all require authentication to be visited. Right now however, what I attempted now does not work as intended.it does not prompt me at all right now, even when I am exactly on the matching route
@Swedish Lapphund it does not prompt me at all right now, even when I am exactly on the matching route
Dwarf Crocodile
move it outside app folder
Dwarf Crocodile
export { default } from "next-auth/middleware";
export const config = { matcher: ["/admin/:path*"] };if you want it go down with route
Answer
@Dwarf Crocodile move it outside app folder
Swedish LapphundOP
Thanks worked!
/solved
!solved
awkward...