-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Hello!
Need your help with the nextBasicAuthMiddleware approach.
I need to have other rules in the middleware function so I'm trying to implement the nextBasicAuthMiddleware function.
createNextAuthMiddleware approach works.
How to implement the nextBasicAuthMiddleware function?
Next.JS 13 with App Router.
When I used the nextBasicAuthMiddleware function basic auth didn't work.
middleware.ts file in the root of the project
import { NextResponse } from 'next/server';
import { nextBasicAuthMiddleware } from 'nextjs-basic-auth-middleware'
const options = {users: [{ name: "test", password: "test" }]};
export const middleware = (req: any) => {
nextBasicAuthMiddleware(options, req)
return NextResponse.next()
}
export const config = {
matcher: ['/(.*)'],
}When I used the createNextAuthMiddleware function basic auth worked well.
import { createNextAuthMiddleware } from 'nextjs-basic-auth-middleware'
const options = {users: [{ name: "test", password: "test" }]};
export const middleware = createNextAuthMiddleware(options)
export const config = {
matcher: ['/(.*)'],
}What did I do wrong? How can I debug this problem?
Metadata
Metadata
Assignees
Labels
No labels