# NextJs complete logout

**URL:** <https://community.auth0.com/t/nextjs-complete-logout/145309>\
**Category:** Get Help\
**Tags:** classic-universal-login-experience, login-experience\
**Created:** [September 5, 2024, 4:58am UTC](https://community.auth0.com/t/nextjs-complete-logout/145309 "2024-09-05T04:58:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![koustov](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/koustov/32/59963_2.png) [@koustov](https://community.auth0.com/u/koustov)\
**Post date:** [September 5, 2024, 4:58am UTC](https://community.auth0.com/t/nextjs-complete-logout/145309/1 "2024-09-05T04:58:27Z")

</div>

Hi,  
I have a situation where I cannot make a complete logout for a user. Here are the details

In my configuration, a user without an organization attached to it, cannot login to the application.  
So, now while login I call `/api/auth/login` and during logout `/api/auth/logout`. . And when any error occurs we have an implementation in `handleAuth` to redirect to some page where we show the actual error. All these seems to be working except one situation mentioned below.

When a user without organization tries to login, I get a proper message and status code back through callback. After that as recommended, I am redirecting to `https:{tenant_domain}/logout?client_id=<client_id>&returnTo=<redirectUrl>` however looks like it is not making a clean logout. So, if we try to hit the login again, instead on showing login page, it return back the same error saying `parameter organization is required for this client`. And it continues. So, I am not able to login again.

Any lead?

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [September 5, 2024, 7:36pm UTC](https://community.auth0.com/t/nextjs-complete-logout/145309/3 "2024-09-05T19:36:25Z")

</div>

Hi @koustov,

Welcome to the Auth0 Community!

The `organization is required for this client` error occurs when the login request does not include the `organization` parameter.

If you are trying to allow non-organization members to log in, you might have to go to your application’s settings \> organization and select **Both** for the type of users who will log in to your application.

This setting will allow users to log in regardless of whether they are a part of an organization.

Let me know how this goes for you.

Thanks,  
Rueben

---

<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 3, 2025, 11:43pm UTC](https://community.auth0.com/t/nextjs-complete-logout/145309/4 "2025-01-03T23:43:23Z")

</div>

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