I am using next-auth with nextjs edge functions. I am using the edge to stream data.
I have my middleware
export { default } from "next-auth/middleware";
// Limit the middleware to paths starting with `/api/`
export const config = {
matcher: "/api/:function*",
};
How do I get access to the session object now in the API route?
As I no longer have access to the normal next req, response, instead it's the Fetch API
const handler = async (req: Request): Promise<Response> => {
// Below will fail
const session = await getServerSession(req, res, authOptions);
Any help is appreciated, thanks!