Verify and extract the user’s ID from a JWT token passed in the x-whop-user-token header passed to iframe apps on your backend.

// app/experiences/[experienceId]/page.tsx

import { whopSdk } from "@/lib/whop-sdk";
import { headers } from "next/headers";

export default async function Page() {
    const headersList = await headers(); // Get the headers from the request.

    // Extract the user ID (read from a verified auth JWT token)
    const { userId } = await whopSdk.verifyUserToken(headersList);

    // Load the user's public profile information
    const user = await whopSdk.users.getUser({ userId: userId });

    console.log(user);

    return (
      <div>
      	<h1>User</h1>
      	<pre>{JSON.stringify(user, null, 2)}</pre>
      </div>
    );

}

Not using the Whop TS SDK?