- Notifications
You must be signed in to change notification settings - Fork0
TheAlexLichter/h3-basic-auth
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Basic Auth middleware for h3 / nitro / ... (based onezpass)
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))
// server/middleware/basic-auth.tsexportdefaultcreateBasicAuthMiddleware({sessionSecret:'secret',// Set this to something usefulusername:'test',// The valid usernamepassword:'test'// The valid password})
sessionSecretbypassonAuthorizeusernamepassword
app.use(createBasicAuthMiddleware({provider:'basic',username:'test',password:'test'}))
- Clone Repository
- Install dependencies with
pnpm install - Use
pnpm dev test/basicto start basic example
MIT
About
No description or website provided.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.