Basic authentication to protect your development website.
This module works Nuxt 3 only.
npm install -D nuxt-basic-authentication-module
import { defineNuxtConfig } from 'nuxt'
import BasicAuth from 'nuxt-basic-authentication-module'
export default defineNuxtConfig({
modules: [
BasicAuth,
],
})
If set to false
, skip registration authentication handler.
import { defineNuxtConfig } from 'nuxt'
import BasicAuth from 'nuxt-basic-authentication-module'
export default defineNuxtConfig({
modules: [
[BasicAuth, { enabled: process.env.IS_PROD !== '1' }], // works unless `IS_PROD=1`
],
})
interface RuntimeConfig {
basicAuth: {
productionDomains?: string[]
pairs?: Record<string, string>
realm?: string
}
}
Authentication is not required in these domains.
['foo.example.com']
matches also bar.foo.example.com
default pair is { admin: 'admin' }
set realm
if needed.
- Run
npm run dev:prepare
to generate type stubs. - Use
npm run dev
to start playground in development mode.