Prevent Logging In Without Promting with Nuxt.js and the Nuxt Auth module

I’m having an issue similar to that documented in this question: rememberLastLogin.

I’m using the Nuxt auth module (auth.nuxtjs.org), and the hosted version of the auth0 universal login.

I’m having no problem logging in, the problem occurs with logging out. The Nuxt auth module seems to just clear the session tokens, but does not query the auth0 endpoint at all.

Last time I built an application with flask we logged out by redirecting the user to auth0_domain.auth0.com/v2/logout with some a redirectTo param. I can’t seem to find a way to do this with Nuxt.

Now, there is a demo application with Nuxt here: https://github.com/nuxt-community/auth-module/tree/dev/examples/demo. When I run this example, after logging out I am directed to the hosted universal log in and asked “Last time you logged in with…” They also don’t do anything with the /v2/logout route.

I would like that feature because as we have it now, there is no way for a user to log in to one account, log out, and log into a different account because the login process immediately redirects to the callback route.

Is there a configuration setting in Auth0 that will mandate the check in my_tenant_domain.auth0.com/login so as not to proceed immediately to the callback?

If not, does anyone have any experience with the Nuxt auth module on where I may be going wrong?

Thank you!
Crawford

I should add one more point - I tried running my Nuxt app with the demo app auth0 domain and client id and received the desired functionality where I am prompted by lock (see attached).

Thus, it seems it is an issue with my auth0 tenant settings. I don’t have access to the demo app auth0 tenant, so I can’t look at what they did to setup.

I think I was able to figure out the issue with the help of the Nuxt community so I wanted to share it here in case anyone else has this issue. For reference , there is a summary of the solution here.

In summary, it seems Auth0 disabled the ability to toggle Seamless SSO sometime in 2017/2018. New tenants can not enable Seamless SSO from their tenants settings. Tenants created in 2017 and before can. Thus, it seems the best option is just to do a redirect to the /v2/logout endpoint to complete the logout of Nuxt and other SPA’s.

Alternatively, it may still be possible to enable this functionality via the prompt query parameter of the /authorize endpoint but I wasn’t able to get that to work with Nuxt and will just use the /v2/logout endpoint instead.

I’ve ran into the same problem and did get the prompt query parameter to work. It ended up being pretty straightforward and clean.

await this.$auth.loginWith('auth0', { params: { prompt: 'login' } })

This forces the login to always ask for credentials.

Hope this helps.

1 Like

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