K
Kinde5mo ago
Dave Gray

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
3 Replies
Dave Gray
Dave GrayOP5mo ago
I think I'm experiencing the same issue that was noted in this bug report on 6/12/24: https://discord.com/channels/1070212618549219328/1250317978004619324/1250317978004619324 That post identifies the merged PR that has the issue and why it is happening. And I can confirm that rolling back to "@kinde-oss/kinde-auth-nextjs": "^2.2.10", eliminates the issue.
Daniel_Kinde
Daniel_Kinde5mo ago
Hi, Thanks for this could you raise an issue on the repo and will get it checked out
Dave Gray
Dave GrayOP5mo ago
GitHub
Bug: isReturnToCurrentPage middleware setting · Issue #188 · kinde-...
Prerequisites I have searched the repository’s issues and Kinde community to ensure my issue isn’t a duplicate I have checked the latest version of the library to replicate my issue I have read the...
Want results from more Discord servers?
Add your server