/Knowledge/sources/honojs__hono/llms-full/basic-auth-middleware-options-onauthsuccess-c-context-username-string-void-promise--0162b7d8f932.md

Basic Auth Middleware: Options > onAuthSuccess: (c: Context, username...

Basic Auth Middleware: Options onAuthSuccess: (c: Context, username: string) = void | Promise Source evidence: /Sources/honojs hono/provenance.md Canonical c...

Basic Auth Middleware: Options > onAuthSuccess: (c: Context, username: string) => void | Promise

Source evidence: /Sources/honojs__hono/provenance.md Canonical citation: https://hono.dev/llms-full.txt#onauthsuccess-c-context-username-string-void-promise

Summary

A callback function invoked after successful authentication. This allows you to set context variables or perform side effects without re-parsing the Authorization header. ```ts app.use( '/auth/*', basicAuth({ username: 'hono', password:...

Content

A callback function invoked after successful authentication. This allows you to set context variables or perform side effects without re-parsing the Authorization header.

app.use(
  '/auth/*',
  basicAuth({
    username: 'hono',
    password: 'acoolproject',
    onAuthSuccess: (c, username) => {
      c.set('username', username)
    },
  })
)

app.get('/auth/page', (c) => {
  const username = c.get('username')
  return c.text(`Hello, ${username}!`)
})

Metadata

{
  "chunk_index": 0,
  "citation": "https://hono.dev/llms-full.txt#onauthsuccess-c-context-username-string-void-promise",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / Basic Auth Middleware > Options > onAuthSuccess: `(c: Context, username: string) => void | Promise `",
  "retrieved_at": "2026-07-02T05:51:01Z",
  "section_index": 295,
  "source_id": "/honojs/hono",
  "source_type": "llms_full",
  "target_label": "llms-full",
  "title": "Basic Auth Middleware: Options > onAuthSuccess: (c: Context, username: string) => void | Promise",
  "upstream_url": "https://hono.dev/llms-full.txt",
  "version": "2026"
}
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Knowledge/sources/honojs__hono/llms-full/basic-auth-middleware-options-onauthsuccess-c-context-username-string-void-promise--0162b7d8f932.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.