Skip to content

V5 auth() function with route handler path params #9426

Answered by hexcowboy
hexcowboy asked this question in Help
Discussion options

You must be logged in to vote

i'm assuming this would probably work

import { NextRequest } from "next/server";

export async function GET(
  request: NextRequest,
  context: { params: { id: string } }
) {
  return auth(async () => {
    // ... you can use `context.params.id` here
  })(request, context) as any;
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@sandercoffee
Comment options

Answer selected by hexcowboy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
3 participants