theo
theo
Explore posts from servers
KKinde
Created by theo on 9/8/2024 in #💻┃support
Unable to visit /admin/*
i have a nextjs app that has an admin page with sub pages like /admin/upload /admin/store etc, it all works in localhost, but in prod i get this behaviour, where clicking on the pages, or navigating via the url sends you back to /admin/ any ideas on what it is? im using app router and protecting with matcher: ["/admin/:path*"] in middleware
12 replies
KKinde
Created by theo on 7/16/2024 in #💻┃support
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",
]
}
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
7 replies