New to Auth0 - Allowed URL Logout not working in my next.js app

Hello, I have a potentially silly issue, but it’s driving me up the wall.

I have created a new application on auth0 and I am trying to get login/logout to work, I am using next.js, and i followed the quickstart tutorial and it all works okay, until i get to the logout. When in the “allowed logout urls” i put localhost:3000 it works fine, but since that’s also where my main app is, I can’t distinguish if i have been logged off or not, it mostly just looks like I refreshed the page.

So to test if the logout is actually working, i created a simple “test-logout” page so “http://localhost:3000/test-logout page”, and on logout i expect to be sent there, modified the allowed urls accordingly and my href on logout in my app is still simply “/api/auth/logout” ( i also tried returnTo argument with no improvements).

Now it’s falling over, and it is not taking me to the test-logout page, so I don’t know if I missed something or doing something wrong?

This is the error I get: “GET 400 (Bad Request)”

(it doesn’t even mention my “/test-logout” in the URL either which I find odd)

this is my href:

and this my routes.ts file:

// app/api/auth/[auth0]/route.js
import { handleAuth } from '@auth0/nextjs-auth0';

export const GET = handleAuth();

BTW the login works fine, that’s why I’m so confused. Any help would be very appreciated!! Thanks

Hi @hello17 , welcome to Auth0!

Thank you for describing your issue!

While your app is running locally, could you try to test the logout by pasting the URL directly to the browser URL bar:


to see if you are redirected to a working logout page?

Could you double check that for the client ID you test the logout, under the Auth0 tenant->applications->your app->Allowed logout URLs there is http://localhost:3000/test-logout url included?

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.