This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getToken } from "next-auth/jwt" | |
import { NextResponse } from "next/server" | |
export async function middleware(req) { | |
// return early if url isn't supposed to be protected | |
if (!req.url.includes("/protected-url")) { | |
return NextResponse.next() | |
} | |
const session = await getToken({ req, secret: process.env.SECRET }) |