NextJs complete logout

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?

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