KindeK
Kinde2y ago
6 replies
theo

Middleware based protection not working

in my middleware.ts, i have the following code
import { withAuth } from "@kinde-oss/kinde-auth-nextjs/middleware"

export default withAuth(
  async function middleware(req) {
    console.log("auth", req.kindeAuth)
  },
  {
    isReturnToCurrentPage: false,
    loginPage: "/signin",
    isAuthorized: ({token}) => {
      return token.permissions.includes("admin:admin");
    }
  }
)

export const config = {
  matcher: [
    "/admin",
    "/about",
  ]
}

however, it simply doesnt protect any routes, while page based protection does work, however i want to avoid using that
Was this page helpful?