Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
NotificationsYou must be signed in to change notification settings

TheAlexLichter/h3-basic-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic Auth middleware for h3 / nitro / ... (based onezpass)

Usage

With h3

import{createApp,defineEventHandler,toNodeListener}from'h3'import{listen}from'listhen'import{createBasicAuthMiddleware}from'h3-basic-auth'constapp=createApp()app.use(createBasicAuthMiddleware({sessionSecret:'secret',// Set this to something usefulusername:'test',// The valid usernamepassword:'test'// The valid password}))app.use(defineEventHandler(event=>`Welcome${event.context.auth?.session.user}!`))listen(toNodeListener(app))

With Nitro

// server/middleware/basic-auth.tsexportdefaultcreateBasicAuthMiddleware({sessionSecret:'secret',// Set this to something usefulusername:'test',// The valid usernamepassword:'test'// The valid password})

Options

  • sessionSecret
  • bypass
  • onAuthorize
  • username
  • password
app.use(createBasicAuthMiddleware({provider:'basic',username:'test',password:'test'}))

Development

  • Clone Repository
  • Install dependencies withpnpm install
  • Usepnpm dev test/basic to start basic example

License

MIT

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp