vue.jsnuxt.jsnuxt-auth

NuxtJS auth redirect after logout to various paths, if needed


Did Google and read the documentation but no solution found yet, please suggest how to log out the user to different paths if needed.

My scenario/issue

Tried (not working)

this.$auth.logout()
this.$router.push('verify')

I am always being redirected to {domain}/login :-(

Tried > still not working Disabled redirect for logout in nuxt.config.js as follows.

auth: {
  redirect: {
    login: '/signin',
    logout: false,
    home: '/'
  },
}

Solution

  • In verify.vue

    <script>
    export default {
      auth: false,
    }
    </script>
    

    And in your logout file

    await this.$auth.logout() // this one needs to be awaited
    await this.$router.push('verify')