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

**URL:** <https://community.auth0.com/t/new-to-auth0-allowed-url-logout-not-working-in-my-next-js-app/123824>\
**Category:** Get Help\
**Tags:** configuration, application\
**Created:** [December 28, 2023, 9:29pm UTC](https://community.auth0.com/t/new-to-auth0-allowed-url-logout-not-working-in-my-next-js-app/123824 "2023-12-28T21:29:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hello17](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@hello17](https://community.auth0.com/u/hello17)\
**Post date:** [December 28, 2023, 9:29pm UTC](https://community.auth0.com/t/new-to-auth0-allowed-url-logout-not-working-in-my-next-js-app/123824/1 "2023-12-28T21:29:06Z")

</div>

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](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 [https://MydomainNAME.eu.auth0.com/v2/logout?client\_id=xxxxxxxxxxxxxxx&returnTo=http%3A%2F%2Flocalhost%3A3000](https://MydomainNAME.eu.auth0.com/v2/logout?client_id=xxxxxxxxxxxxxxx&returnTo=http%3A%2F%2Flocalhost%3A3000) 400 (Bad Request)”

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

this is my href:  
[Logout](https://community.auth0.com/api/auth/logout)

and this my routes.ts file:

```auto
// 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

---

<div class="post-metadata">

**Author:** ![marcelina.barycka](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/marcelina.barycka/32/56162_2.png) [@marcelina.barycka](https://community.auth0.com/u/marcelina.barycka)\
**Post date:** [January 4, 2024, 12:44pm UTC](https://community.auth0.com/t/new-to-auth0-allowed-url-logout-not-working-in-my-next-js-app/123824/2 "2024-01-04T12:44:37Z")

</div>

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:

`https://{yourDomain}/v2/logout?client_id={yourClientId}&returnTo=http%3A%2F%2Flocalhost%3A3000%2Ftest-logout`

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

> [@hello17](#):
>
> So to test if the logout is actually working, i created a simple “test-logout” page so “[http://localhost:3000/test-logout](http://localhost:3000/test-logout) page”, and on logout i expect to be sent there, modified the allowed urls accordingly

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](http://localhost:3000/test-logout) url included?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [January 18, 2024, 12:45pm UTC](https://community.auth0.com/t/new-to-auth0-allowed-url-logout-not-working-in-my-next-js-app/123824/3 "2024-01-18T12:45:26Z")

</div>

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