Dave Gray
Dave Gray
KKinde
Created by Dave Gray on 7/9/2024 in #💻┃support
isReturnToCurrentPage in Next.js middleware
"@kinde-oss/kinde-auth-nextjs": "^2.3.3", and "next": "^14.2.3", My middleware setting:
export default function middleware(req: NextRequest) {
return withAuth(req, {
isReturnToCurrentPage: true,
});
}
export default function middleware(req: NextRequest) {
return withAuth(req, {
isReturnToCurrentPage: true,
});
}
My expectations: - Go directly to domain.com/books/scifi and get redirected to login - as expected. - After logging in, get redirected back to domain.com/books/scifi - fails. I can see the GET request go through with this URL: /api/auth/login?post_login_redirect_url=/books/scifi But Next.js gives this error: ⨯ Error: URL is malformed "/books/scifi". Please use only absolute URLs
5 replies