Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (22 sloc) 633 Bytes

Auth Middleware

You can enable auth middleware either globally or per route. When this middleware is enabled on a route and loggedIn is false user will be redirected to redirect.login route. (/login by default)

Setting per route:

export default {
  middleware: 'auth'
}

Globally setting in nuxt.config.js:

router: {
  middleware: ['auth']
}

In case of global usage, You can set auth option to false in a specific component and the middleware will ignore that route.

export default {
  auth: false
}

πŸ‘‰ Now you have to configure some Strategies for auth.