Auth-module: Auth middleware not working the way it should

Created on 7 Jan 2019  路  2Comments  路  Source: nuxt-community/auth-module

Whenever i try to login this auth module won't redirect me to home /.However on logout it keeps redirects me to logout which is ok but when i refresh the home page it keeps allowing me to visit it even if i am not logged in which seems like a pretty serious bug.I am using auth middleware to protect it but still no luck!
Here is my auth object

auth: {
    strategies: {
      local: {
        endpoints: {
          login: { url: 'users/signin', method: 'post', propertyName: 'user.token' },
          user: { url: 'users/me', method: 'get', propertyName: 'data' },
          logout: false
        }
      }
    },
    redirect: {
      // login: '/',
      logout: '/login',
      home: '/',
      callback: '/'
    },
    watchLoggedIn: true,
    rewriteRedirects: true
  }

Any help regarding this issue would be really appreciated

This question is available on Nuxt community (#c259)
question

Most helpful comment

Hey, don't know if you found a solution but you need to add the following to your nuxt.config.js file

  router: {
    middleware: [
      'auth',
    ]
  },

https://auth.nuxtjs.org/guide/middleware.html

All 2 comments

This issue as been imported as question since it does not respect auth-module issue template. Only bug reports and feature requests stays open to reduce maintainers workload.
If your issue is not a question, please mention the repo admin or moderator to change its type and it will be re-opened automatically.
Your question is available at https://cmty.app/nuxt/auth-module/issues/c259.

Hey, don't know if you found a solution but you need to add the following to your nuxt.config.js file

  router: {
    middleware: [
      'auth',
    ]
  },

https://auth.nuxtjs.org/guide/middleware.html

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pi0 picture pi0  路  3Comments

sebmor picture sebmor  路  3Comments

weijinnx picture weijinnx  路  3Comments

ishitatsuyuki picture ishitatsuyuki  路  4Comments

yuwacker picture yuwacker  路  3Comments