Permalink
Branch: master
Find file Copy path
13d508a Apr 2, 2018
1 contributor

Users who have contributed to this file

29 lines (22 sloc) 388 Bytes

Extending Auth plugin

If you have plugins that need to access $auth, you can use auth.plugins option.

nuxt.config.js

{
  modules: {
    '@nuxtjs/auth'
  },
  auth: {
     plugins: [ '~/plugins/auth.js' ]
  }
}

plugins/auth.js

export default function ({ app }) {
  if (!app.$auth.loggedIn) {
    return
  }

  const username = app.$auth.user.username
}