/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-defining-multiple-u-ee6df59d68bb-defining-multiple-users-s0299-c0000.md
Defining Multiple Users - hono-docs
Defining Multiple Users Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt defining multiple users S...
Defining Multiple Users
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#defining-multiple-users
Summary
This middleware also allows you to pass arbitrary parameters containing objects defining more username and password pairs. ```ts app.use( '/auth/*', basicAuth( { username: 'hono', password: 'acoolproject', // Define other params in t...
Content
This middleware also allows you to pass arbitrary parameters containing objects defining more username and password pairs.
app.use(
'/auth/*',
basicAuth(
{
username: 'hono',
password: 'acoolproject',
// Define other params in the first object
realm: 'www.example.com',
},
{
username: 'hono-admin',
password: 'super-secure',
// Cannot redefine other params here
},
{
username: 'hono-user-1',
password: 'a-secret',
// Or here
}
)
)Or less hardcoded:
import { users } from '../config/users'
app.use(
'/auth/*',
basicAuth(
{
realm: 'www.example.com',
...users[0],
},
...users.slice(1)
)
)