Skip to main content
Cal OAuth Provider is used to setup Cal Atoms within your app after your users have authenticated using your Cal OAuth 2.0 client. Your users will have authenticated with your Cal OAuth client and you will have access to their access tokens, which the Cal Atoms will use to manage their event type settings, availability, etc. within your app. It is used in the root of your app, be it _app.js or _app.tsx in case of Next.js or App.js or App.ts in case of React. Here is an example:
import "@calcom/atoms/globals.min.css";
import { CalOAuthProvider } from '@calcom/atoms';

function MyApp({ Component, pageProps }) {
  const accessToken = "user-oauth-access-token";

  return (
    <CalOAuthProvider
      accessToken={accessToken}
      clientId={process.env.CAL_OAUTH2_CLIENT_ID ?? ""}
      options={{
        apiUrl: process.env.CAL_API_URL ?? "https://api.cal.com/v2",
        refreshUrl: process.env.REFRESH_URL
      }}
    >
      <Component {...pageProps} />
    </CalOAuthProvider>
  );
}

export default MyApp;
Below is a list of props that can be passed to the Cal OAuth Provider.
NameRequiredDescription
clientIdYesYour OAuth2 client ID
optionsYesConfiguration options - apiUrl (should be https://api.cal.com/v2) and refreshUrl (URL of endpoint you have to build that to which atoms will send expired access tokens and receive new one in return. readingDirection (defaults to “ltr” but can also pass “rtl” which will change direction of UI components)
accessTokenYesThe access token of your user for whom cal handles scheduling.
autoUpdateTimezoneNoWhether to automatically update managed user timezone (default: true)
languageNoLanguage code (default: “en”) - available languages: “en”, “de”, “fr”, “it”, “nl”, “pt-BR”, “es”
organizationIdNoID of your organization