yarn add nuxt-basic-auth
In your nuxt config:
export default defineNuxtConfig({
modules: ['nuxt-basic-auth'],
basicAuth: {
username: 'theUsername',
password: 'thePassword',
// enabled: true // true by default
},
The configuration should be obvious from the usage. You can set username and password through basicAuth object key on nuxt configuration file (nuxt.config.ts
or nuxt.config.js
). The enabled
configuration key can be set to false
to disable basic authentication.
- Add Nuxt 2 support
- Add tests