Skip to content

Commit f202f1f

Browse files
committed
Added a hono version of woekrs examples - basic auth fix
1 parent 3583c21 commit f202f1f

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/content/docs/workers/examples/basic-auth.mdx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,14 +364,8 @@ app.get('/logout', (c) => {
364364
});
365365
366366
// Admin route - protected with Basic Auth
367-
app.get('/admin',
368-
basicAuth({ username: BASIC_USER, password: c.env.PASSWORD }),
369-
async (c) => {
370-
371-
// Success! User is authenticated
372-
return c.text("🎉 You have private access!", 200, {
373-
'Cache-Control': 'no-store',
374-
});
367+
app.get('/admin', async (c, next) => {
368+
return basicAuth({ username: c.env.USERNAME, password: c.env.PASSWORD })(c, next);
375369
});
376370
377371
// Handle 404 for any other routes

0 commit comments

Comments
 (0)