I’m using @auth0/nextjs-auth0 version 1.9.1 with Next.js version 14.2.1 in my application. I’m encountering an issue with the logout process, where I’m redirected to a 404 error page with the following URL structure:
/v2/logout?returnTo=http://localhost:3000/login?client_id=12334
import { handleLogout } from ‘@auth0/nextjs-auth0’;
export default async function logout(req, res) {
try {
await handleLogout(req, res, {
returnTo: 'http://localhost:3000/login'
});
} catch (error) {
console.error(error);
res.status(error.status || 500).end(error.message);
}
}
It seems like the returnTo parameter isn’t being handled correctly, and I’m not sure if the client_id should be part of this URL.
I’ve ensured that the http://localhost:3000/login URL is added to the “Allowed Logout URLs” in my Auth0 dashboard. Despite this, I still encounter the 404 error page.
What might be causing the 404 error, and how can I properly configure the logout process in Auth0?
Any insights or guidance would be greatly appreciated!