Nuxt.js
Create project
Section titled “Create project”$ yarn create nuxt-app <project-name>
Add modules Auth
Section titled “Add modules Auth”- Install with yarn:
$ yarn add @nuxtjs/auth @nuxtjs/axios
- Edit nuxt.config.js:
modules: [ '@nuxtjs/auth']
- Setup auth middleware globally in nuxt.config.js
router: { middleware: ['auth']}
- Auth strategy example (still in nuxt.config.js)
auth: { strategies: { login: { url: '/login', method: 'post', propertyName: 'token' }, user: { url: '/users/me', method: 'get', propertyName: false }, }}