fix: unable to create meeting with ms teams (#20993)

* fix: few details not populate

* fix: unable to create meeting with ms teams

* Update CrmService.ts

* update
This commit is contained in:
Anik Dhabal Babu
2025-04-28 13:41:02 +00:00
committed by GitHub
parent bd1142ea7a
commit 54c17eb827
3 changed files with 6 additions and 8 deletions
+2 -2
View File
@@ -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,
@@ -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,
});
@@ -14,6 +14,7 @@ import type { VideoApiAdapter, VideoCallData } from "@calcom/types/VideoApiAdapt
import 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,