/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-usage-492647be7ffd-usage-s0250-c0001.md
Usage (2) - hono-docs
Usage (2) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt usage Summary To implement multiple tok...
Usage (2)
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#usage
Summary
To implement multiple tokens (E.g., any valid token can read but create/update/delete are restricted to a privileged token): ```ts const app = new Hono() const readToken = 'read' const privilegedToken = 'read+write' const privilegedMetho...
Content
To implement multiple tokens (E.g., any valid token can read but create/update/delete are restricted to a privileged token):
const app = new Hono()
const readToken = 'read'
const privilegedToken = 'read+write'
const privilegedMethods = ['POST', 'PUT', 'PATCH', 'DELETE']
app.on('GET', '/api/page/*', async (c, next) => {
// List of valid tokens
const bearer = bearerAuth({ token: [readToken, privilegedToken] })
return bearer(c, next)
})
app.on(privilegedMethods, '/api/page/*', async (c, next) => {
// Single valid privileged token
const bearer = bearerAuth({ token: privilegedToken })
return bearer(c, next)
})
// Define handlers for GET, POST, etc.If you want to verify the value of the token yourself, specify the verifyToken option; returning true means it is accepted.