potato4d / nuxt-basic-auth-module

Provide basic auth your Nuxt.js application
https://www.npmjs.com/package/nuxt-basic-auth-module
MIT License
311 stars 9 forks source link
authentication basic-authentication javascript nuxt nuxt-module vue vuejs

Nuxt.js basic auth module

code style: prettier donate: Patreon License: MIT NPM version All Contributors NPM downloads codecov

f2653ad0d131606c49edb3f605cbf547

Provide basic authentication to your Nuxt.js application

https://www.npmjs.com/package/nuxt-basic-auth-module

Installation

$ yarn add nuxt-basic-auth-module # or npm install

Usage

Edit your nuxt.config.js

export default {
  // ...
  modules: [
    'nuxt-basic-auth-module'
  ],
  basic: {
    name: 'AUTH USER NAME HERE',
    pass: 'AUTH PASSWORD HERE',
    enabled: process.env.BASIC_ENABLED === 'true' // require boolean value(nullable)
  },

  // ...
}

Arguments

enabled

Whether to activate this module. If false, module registration is skipped.

name

Basic Auth user name.

The function passes req as an argument and must return the username as string.

pass

Basic Auth user password.

The function passes req as an argument and must return the password as string.

message

Message to be displayed during basic authentication.

match

The target path. This allows you to set up basic authentication that is limited to routes that match regular expression literals or where the function returns true.

The function passes req as an argument.

License

MIT

https://github.com/potato4d/nuxt-basic-auth-module/blob/master/LICENSE

Contributors

Thanks goes to these wonderful people (emoji key):


Takuma HANATANI

πŸ’» 🚧 πŸ“– πŸ›

Anthony Fu

πŸ’»

Jleroy

πŸ’»

This project follows the all-contributors specification. Contributions of any kind welcome!