-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Thank you for providing awesome package.
I've noticed this middleware returns 500 if basicAuthentication
throws BadRequestException
nextjs-basic-auth-middleware/src/middleware.ts
Lines 52 to 56 in db07837
const currentUser = basicAuthentication(authHeader) | |
if (currentUser && compareCredentials(currentUser, credentialsObject)) { | |
return NextResponse.next() | |
} |
Is it intentional?
Actual
$ curl localhost:3000 -H 'authorization: foo' -I
HTTP/1.1 500 Internal Server Error
Expectation
$ curl localhost:3000 -H 'authorization: foo' -I
HTTP/1.1 400 Bad Request
middleware.ts
import { createNextAuthMiddleware } from "nextjs-basic-auth-middleware";
export const middleware = createNextAuthMiddleware({
users: [{ name: "foo", password: "bar" }],
});
export const config = {
matcher: ["/(.*)"],
};
Metadata
Metadata
Assignees
Labels
No labels