Next.js Discord

Discord Forum

Why is my auth middleware not working?

Unanswered
Catla posted this in #help-forum
Open in Discord
CatlaOP
Hi.

I am trying to protect two directories: /settings and /manage.

The pages in each of the two directories are a mixture of server and client.

Here is my middleware.ts, which is placed in my src folder:

export { auth as middleware } from '@/auth';

export const config = {
    matcher: ['/manage/:path*', '/settings/:path*'],
};


Despite this adhering to next/next-auth documentation, it does not redirerect the user to any other page. It does nothing, it let's the user view these pages.

How do I fix this?

0 Replies