next.js/examples/with-clerk/app/api/getAuthenticatedUserId/route.ts
route.ts11 lines317 B
import { auth } from "@clerk/nextjs";
import { NextResponse } from "next/server";

export async function GET(request: Request) {
  const { userId, sessionId } = auth();
  if (!sessionId) {
    return NextResponse.json({ id: null }, { status: 401 });
  }
  return NextResponse.json({ id: userId }, { status: 200 });
}
Quest for Codev2.0.0
/
SIGN IN