get nextauth v5 session from route handler on nextjs app router version
Unanswered
Southeastern blueberry bee posted this in #help-forum
Southeastern blueberry beeOP
Hello, is this the correct way to get session from route handler on nextjs app router with nextauth v5 ?
..export async function POST(request: NextRequest) {
const session = await auth()...7 Replies
Southeastern blueberry beeOP
in the documentation they explain for, server component, client component and middleware but not for route handler thats why im asking
American Crow
Yes it is.
You may want to elaborate why you need it within a route handler should be a rare case in general
You may want to elaborate why you need it within a route handler should be a rare case in general
Southeastern blueberry beeOP
@American Crow im exposing only one route handler for webhook otherwise i use server action
ty btw
@Southeastern blueberry bee <@240974567730970625> im exposing only one route handler for webhook otherwise i use server action
American Crow
okay yea that use case is fine. 👍
@Southeastern blueberry bee <@240974567730970625> im exposing only one route handler for webhook otherwise i use server action
American Crow
one more thing. Under the hood a server action does create a route handler for you. So technically everything the docs say about server actions applies to route handlers as well
Southeastern blueberry beeOP
Interesting Thank you