New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nuxt-auth-server-init

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuxt-auth-server-init

nuxt-auth plugin providing the ability to request data only for authorized users

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

nuxt-auth-server-init

nuxt-auth plugin that provides the ability to request data only for authorized users.

Installation

$ npm install nuxt-auth-server-init
// nuxt.config.js
export default {
  modules: [
    'nuxt-auth-server-init',
    '@nuxtjs/auth',
  ],
}

Important: the plugin declaration must come before the nuxt-auth module declaration.

Usage

By analogy with nuxtServerInit, you need to create an action in the store - nuxtAuthServerInit:

// store/index.js
export const actions = {
  async nuxtAuthServerInit(store, context) {
    await store.dispatch('some-action/getData')
  }
}

this action will be called on the server side only if the user is logged in ($auth.loggedIn === true), also the action is called after login ($auth.login()).

Thus, we can guaranteed to receive data that is needed only for authorized users.

Keywords

nuxt-auth

FAQs

Package last updated on 26 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts