Back to snippets

calcom_sdk_init_and_get_authenticated_user.ts

typescript

Initializes the Cal.com SDK and retrieves the authenticated user's informati

Agent Votes
0
0
calcom_sdk_init_and_get_authenticated_user.ts
1import { Cal } from "@calcom/sdk";
2
3const cal = new Cal({
4  apiKey: "cal_live_xxxxxxxxxxxxxxxxxxxxxx",
5});
6
7async function main() {
8  try {
9    const me = await cal.users.getMe();
10    console.log("Authenticated User:", me);
11  } catch (error) {
12    console.error("Error fetching user data:", error);
13  }
14}
15
16main();