Skip to content

Wrapping auth() for Protected Routes and Encapsulating Logic #13000

Closed Answered by mikeE-finsight
mikeE-finsight asked this question in Help
Discussion options

You must be logged in to vote

Ok classic brain fart here. I need to await the authJsRoute() call:

export const GET = await authJsRoute(async (request: NextAuthRequest) => {
  logger.info('AuthRequiredRoute', {
    auth: request.auth,
  });
  return NextResponse.json(
    { message: `Hello, ${request.auth?.user?.name || 'Guest'}!` },
    { status: 200 }
  );
});

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mikeE-finsight
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant