next-auth question about API route
Unanswered
American black bear posted this in #help-forum
American black bearOP
Has anyone used next-auth? Is there a way to get the session with route handlers (
Reference: https://next-auth.js.org/tutorials/securing-pages-and-api-routes#securing-api-routes
GET
, POST
, UPDATE
, DELETE
) instead of having all the function requests in one function for protecting API routes? I can't use getServerSession
with NextResponse
but only with NextApiResponse
. Is there any workaround for this?Reference: https://next-auth.js.org/tutorials/securing-pages-and-api-routes#securing-api-routes
2 Replies
American black bearOP
or is there any way to use the export default inside route with next15?
you can use cookies from next/headers