Scheduling infrastructure for absolutely everyone.
fix: unable to create meeting with ms teams (#20993)
Anik Dhabal Babu54c17eb82739
diff --git a/packages/app-store/office365video/api/add.ts b/packages/app-store/office365video/api/add.tsindex 5abf7ef2873..2da0a81caf6 100644--- a/packages/app-store/office365video/api/add.ts+++ b/packages/app-store/office365video/api/add.ts@@ -6,7 +6,7 @@ import { WEBAPP_URL_FOR_OAUTH } from "@calcom/lib/constants";import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";import { encodeOAuthState } from "../../_utils/oauth/encodeOAuthState";-const scopes = ["OnlineMeetings.ReadWrite", "offline_access"];+export const OFFICE365_VIDEO_SCOPES = ["OnlineMeetings.ReadWrite", "offline_access"];export default async function handler(req: NextApiRequest, res: NextApiResponse) {if (req.method === "GET") {@@ -17,7 +17,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)const state = encodeOAuthState(req);const params = {response_type: "code",- scope: scopes.join(" "),+ scope: OFFICE365_VIDEO_SCOPES.join(" "),client_id: clientId,redirect_uri: `${WEBAPP_URL_FOR_OAUTH}/api/integrations/office365video/callback`,state,diff --git a/packages/app-store/office365video/api/callback.ts b/packages/app-store/office365video/api/callback.tsindex e144429b05a..c511647ccca 100644--- a/packages/app-store/office365video/api/callback.ts+++ b/packages/app-store/office365video/api/callback.ts@@ -8,8 +8,7 @@ import getAppKeysFromSlug from "../../_utils/getAppKeysFromSlug";import getInstalledAppPath from "../../_utils/getInstalledAppPath";import createOAuthAppCredential from "../../_utils/oauth/createOAuthAppCredential";import { decodeOAuthState } from "../../_utils/oauth/decodeOAuthState";--const scopes = ["OnlineMeetings.ReadWrite", "offline_access"];+import { OFFICE365_VIDEO_SCOPES } from "./add";export default async function handler(req: NextApiRequest, res: NextApiResponse) {const { code } = req.query;@@ -45,7 +44,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)client_id: clientId,grant_type: "authorization_code",code,- scope: scopes.join(" "),+ scope: OFFICE365_VIDEO_SCOPES.join(" "),redirect_uri: `${WEBAPP_URL_FOR_OAUTH}/api/integrations/office365video/callback`,client_secret: clientSecret,});diff --git a/packages/app-store/office365video/lib/VideoApiAdapter.ts b/packages/app-store/office365video/lib/VideoApiAdapter.tsindex c0a84ab2cc2..33eded8338b 100644--- a/packages/app-store/office365video/lib/VideoApiAdapter.ts+++ b/packages/app-store/office365video/lib/VideoApiAdapter.ts@@ -14,6 +14,7 @@ import type { VideoApiAdapter, VideoCallData } from "@calcom/types/VideoApiAdaptimport getParsedAppKeysFromSlug from "../../_utils/getParsedAppKeysFromSlug";import { OAuthManager } from "../../_utils/oauth/OAuthManager";import { oAuthManagerHelper } from "../../_utils/oauth/oAuthManagerHelper";+import { OFFICE365_VIDEO_SCOPES } from "../api/add";import config from "../config.json";/** @link https://docs.microsoft.com/en-us/graph/api/application-post-onlinemeetings?view=graph-rest-1.0&tabs=http#response */@@ -68,9 +69,7 @@ const TeamsVideoApiAdapter = (credential: CredentialForCalendarServiceWithTenant}const url = getAuthUrl(isDelegated, credential?.delegatedTo?.serviceAccountKey?.tenant_id);- const scope = isDelegated- ? "https://graph.microsoft.com/.default"- : "User.Read Calendars.Read Calendars.ReadWrite";+ const scope = isDelegated ? "https://graph.microsoft.com/.default" : OFFICE365_VIDEO_SCOPES.join(" ");const params: Record<string, string> = {scope,