{"id":15659056,"url":"https://github.com/TheAlexLichter/h3-basic-auth","last_synced_at":"2025-03-30T01:32:07.088Z","repository":{"id":228719009,"uuid":"774656308","full_name":"manniL/h3-basic-auth","owner":"manniL","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-27T23:18:03.000Z","size":71,"stargazers_count":23,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-30T01:56:58.692Z","etag":null,"topics":["auth","basic-auth","basic-authentication","h3","nitro","nitropack"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manniL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-19T23:46:01.000Z","updated_at":"2024-09-26T09:53:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"2140ed88-40ec-4f9e-8188-dcf590559109","html_url":"https://github.com/manniL/h3-basic-auth","commit_stats":null,"previous_names":["mannil/h3-basic-auth"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manniL%2Fh3-basic-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manniL%2Fh3-basic-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manniL%2Fh3-basic-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manniL%2Fh3-basic-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manniL","download_url":"https://codeload.github.com/manniL/h3-basic-auth/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222520469,"owners_count":16996970,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth","basic-auth","basic-authentication","h3","nitro","nitropack"],"created_at":"2024-10-03T13:14:47.333Z","updated_at":"2025-03-30T01:32:01.737Z","avatar_url":"https://github.com/manniL.png","language":"TypeScript","readme":"# h3-basic-auth\n\n\u003e Basic Auth middleware for h3 / nitro / ... (based on [ezpass](https://github.com/unjs/ezpass))\n\n## Usage\n\n### With h3\n\n```ts\nimport { createApp, defineEventHandler, toNodeListener } from 'h3'\nimport { listen } from 'listhen'\nimport { createBasicAuthMiddleware } from 'h3-basic-auth'\n\nconst app = createApp()\n\napp.use(createBasicAuthMiddleware({\n  sessionSecret: 'secret', // Set this to something useful\n  username: 'test', // The valid username\n  password: 'test' // The valid password\n}))\n\napp.use(defineEventHandler(event =\u003e `Welcome ${event.context.auth?.session.user}!`))\n\nlisten(toNodeListener(app))\n```\n\n### With Nitro\n\n```ts\n// server/middleware/basic-auth.ts\nexport default createBasicAuthMiddleware({\n  sessionSecret: 'secret', // Set this to something useful\n  username: 'test', // The valid username\n  password: 'test' // The valid password\n})\n```\n\n## Options\n\n- `sessionSecret`\n- `bypass`\n- `onAuthorize`\n- `username`\n- `password`\n\n```ts\napp.use(createBasicAuthMiddleware({\n  provider: 'basic',\n  username: 'test',\n  password: 'test'\n}))\n```\n\n## Development\n\n- Clone Repository\n- Install dependencies with `pnpm install`\n- Use `pnpm dev test/basic` to start basic example\n\n## License\n\nMIT\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheAlexLichter%2Fh3-basic-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTheAlexLichter%2Fh3-basic-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheAlexLichter%2Fh3-basic-auth/lists"}