Next.js Discord

Discord Forum

matcher next auth api next14

Unanswered
American posted this in #help-forum
Open in Discord
AmericanOP
Followed the official learn tutorial for next 14, which introduces nextauth with middleware and following matcher:
matcher: ["/((?!api|_next/static|_next/image|.*\\.png$).*)"],
Now i want my api behind auth. Is this possible? I tried a lot, but cant achieve. my last try:
  matcher: ["/((?!_next/static|_next/image|.*\\.png$).*)", "/api/"],
No success. api is still reachable for everyone... . Many thanks in advance.

0 Replies