Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Handle Zoom app deauthorization events (#3373)

Luke Vella9dbc7a9296ed
diff --git a/apps/docs/integrations/zoom.mdx b/apps/docs/integrations/zoom.mdx
index 35c116a0d..4d4949e3c 100644
--- a/apps/docs/integrations/zoom.mdx
+++ b/apps/docs/integrations/zoom.mdx
@@ -131,7 +131,7 @@ You can also remove the app from the Zoom side:
2. Click **Manage**, then **Added Apps**.
3. Find **Rallly** and click **Remove**.
-Removing the app from Zoom revokes Rallly's access. Disconnect the account in Rallly as well so it no longer appears in your settings.
+Removing the app from Zoom revokes Rallly's access. Zoom tells Rallly, which deletes the connection and the tokens it stored, so the account no longer appears in your settings. On a self-hosted instance, this needs the administrator to set up Zoom's deauthorization notice, which Zoom only sends for apps published on the Marketplace. If the account still appears in your settings, disconnect it in Rallly as well.
## Troubleshooting
diff --git a/apps/web/.env.sample b/apps/web/.env.sample
index 5aed7403c..05d983045 100644
--- a/apps/web/.env.sample
+++ b/apps/web/.env.sample
@@ -50,3 +50,5 @@ NEXT_PUBLIC_SELF_HOSTED=false
# CONFERENCING_ENABLED=false
# ZOOM_CLIENT_ID=
# ZOOM_CLIENT_SECRET=
+# Secret Token from the Zoom app's Features page; verifies deauthorization events.
+# ZOOM_WEBHOOK_SECRET_TOKEN=
diff --git a/apps/web/.env.test b/apps/web/.env.test
index dedfd9cbb..8061ceade 100644
--- a/apps/web/.env.test
+++ b/apps/web/.env.test
@@ -23,3 +23,4 @@ WEBHOOK_ALLOW_PRIVATE_URLS=true
CONFERENCING_ENABLED=true
ZOOM_CLIENT_ID=test-zoom
ZOOM_CLIENT_SECRET=test-zoom-secret
+ZOOM_WEBHOOK_SECRET_TOKEN=test-zoom-webhook-secret
diff --git a/apps/web/src/app/api/integrations/zoom/deauthorize/route.ts b/apps/web/src/app/api/integrations/zoom/deauthorize/route.ts
new file mode 100644
index 000000000..bc431c57f
--- /dev/null
+++ b/apps/web/src/app/api/integrations/zoom/deauthorize/route.ts
@@ -0,0 +1,127 @@
+import type { WideEvent } from "@rallly/logger";
+import { createWideEvent, logger } from "@rallly/logger";
+import * as Sentry from "@sentry/nextjs";
+import type { NextRequest } from "next/server";
+import { NextResponse } from "next/server";
+import { env } from "@/env";
+import { removeDeauthorizedZoomUser } from "@/features/conferencing/mutations";
+import {
+ zoomDeauthorizationPayloadSchema,
+ zoomUrlValidationPayloadSchema,
+ zoomWebhookEventSchema,
+} from "@/features/conferencing/schema";
+import {
+ createZoomUrlValidationResponse,
+ verifyZoomWebhookSignature,
+} from "@/features/conferencing/utils";
+import { runtime } from "@/lib/effect/runtime";
+
+async function handleZoomEvent(req: NextRequest, event: WideEvent) {
+ const secretToken = env.ZOOM_WEBHOOK_SECRET_TOKEN;
+ if (!secretToken) {
+ return NextResponse.json({ error: "Not found" }, { status: 404 });
+ }
+
+ const body = await req.text();
+ // The validation challenge is signed too, and must be verified: answering
+ // it unverified would hand anyone an HMAC of a string they choose.
+ const verification = await verifyZoomWebhookSignature({
+ secretToken,
+ signature: req.headers.get("x-zm-signature"),
+ timestamp: req.headers.get("x-zm-request-timestamp"),
+ body,
+ now: new Date(),
+ });
+ if (!verification.ok) {
+ event.errorCode = verification.reason;
+ return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
+ }
+
+ let json: unknown;
+ try {
+ json = JSON.parse(body);
+ } catch {
+ return NextResponse.json({ error: "Invalid body" }, { status: 400 });
+ }
+ const parsed = zoomWebhookEventSchema.safeParse(json);
+ if (!parsed.success) {
+ return NextResponse.json({ error: "Invalid body" }, { status: 400 });
+ }
+ event.zoomEvent = parsed.data.event;
+
+ switch (parsed.data.event) {
+ case "endpoint.url_validation": {
+ const payload = zoomUrlValidationPayloadSchema.safeParse(
+ parsed.data.payload,
+ );
+ if (!payload.success) {
+ return NextResponse.json({ error: "Invalid body" }, { status: 400 });
+ }
+ return NextResponse.json(
+ await createZoomUrlValidationResponse({
+ secretToken,
+ plainToken: payload.data.plainToken,
+ }),
+ );
+ }
+ case "app_deauthorized": {
+ const payload = zoomDeauthorizationPayloadSchema.safeParse(
+ parsed.data.payload,
+ );
+ if (!payload.success) {
+ return NextResponse.json({ error: "Invalid body" }, { status: 400 });
+ }
+ event.zoomUserId = payload.data.user_id;
+ const result = await runtime.runPromise(
+ removeDeauthorizedZoomUser({
+ zoomUserId: payload.data.user_id,
+ deauthorizedAt: new Date(payload.data.deauthorization_time),
+ }),
+ );
+ event.removedConnections = result.removedConnections;
+ event.removedCredentials = result.removedCredentials;
+ // Acknowledged even when nothing matched: Zoom retries anything else.
+ return NextResponse.json({ received: true });
+ }
+ default:
+ return NextResponse.json({ received: true, ignored: true });
+ }
+}
+
+// Zoom's deauthorization notification endpoint: when a user removes the app
+// in the Zoom App Marketplace, Rallly deletes what it stored for them.
+export async function POST(req: NextRequest) {
+ const startTime = Date.now();
+ const event = createWideEvent({
+ service: "zoom-webhook",
+ requestId:
+ req.headers.get("x-vercel-id") ??
+ req.headers.get("x-request-id") ??
+ undefined,
+ method: req.method,
+ path: req.nextUrl.pathname,
+ });
+
+ let response: Response;
+ try {
+ response = await handleZoomEvent(req, event);
+ } catch (error) {
+ // A 500 makes Zoom retry, so a failed delete is not lost.
+ Sentry.captureException(error);
+ event.errorType = error instanceof Error ? error.name : "UnknownError";
+ event.errorMessage = error instanceof Error ? error.message : undefined;
+ response = NextResponse.json({ error: "Internal error" }, { status: 500 });
+ }
+
+ event.statusCode = response.status;
+ event.durationMs = Date.now() - startTime;
+ if (response.status >= 500) {
+ logger.error(event);
+ } else if (response.status >= 400) {
+ logger.warn(event);
+ } else {
+ logger.info(event);
+ }
+
+ return response;
+}
diff --git a/apps/web/src/env.ts b/apps/web/src/env.ts
index 228382cfa..2907d7bd9 100644
--- a/apps/web/src/env.ts
+++ b/apps/web/src/env.ts
@@ -116,6 +116,8 @@ export const env = createEnv({
CONFERENCING_ENABLED: z.enum(["true", "false"]).default("false"),
ZOOM_CLIENT_ID: z.string().optional(),
ZOOM_CLIENT_SECRET: z.string().optional(),
+ // Signs Zoom's event notifications, including app deauthorization.
+ ZOOM_WEBHOOK_SECRET_TOKEN: z.string().optional(),
/**
* Microsoft Integration
@@ -291,6 +293,7 @@ export const env = createEnv({
CONFERENCING_ENABLED: process.env.CONFERENCING_ENABLED,
ZOOM_CLIENT_ID: process.env.ZOOM_CLIENT_ID,
ZOOM_CLIENT_SECRET: process.env.ZOOM_CLIENT_SECRET,
+ ZOOM_WEBHOOK_SECRET_TOKEN: process.env.ZOOM_WEBHOOK_SECRET_TOKEN,
MICROSOFT_TENANT_ID: process.env.MICROSOFT_TENANT_ID,
MICROSOFT_CLIENT_ID: process.env.MICROSOFT_CLIENT_ID,
MICROSOFT_CLIENT_SECRET: process.env.MICROSOFT_CLIENT_SECRET,
diff --git a/apps/web/src/features/conferencing/mutations.ts b/apps/web/src/features/conferencing/mutations.ts
index ff6eefa83..aad248816 100644
--- a/apps/web/src/features/conferencing/mutations.ts
+++ b/apps/web/src/features/conferencing/mutations.ts
@@ -2,8 +2,10 @@ import "server-only";
import { prisma } from "@rallly/database";
import { createLogger } from "@rallly/logger";
+import { Effect } from "effect";
import { after } from "next/server";
import { loadCredential } from "@/features/credentials/data";
+import { fromPrisma } from "@/lib/effect/db";
import type { UserInfo } from "@/lib/oauth/types";
import { revokeZoomToken } from "./service";
@@ -111,3 +113,41 @@ const removeConferencingConnection = async ({
after(() => revokeZoomToken({ credential }));
}
};
+
+// Zoom has already revoked the grant, so unlike a disconnect there is nothing
+// to revoke. The Zoom user id is global, so every Rallly account that linked it
+// loses the connection, and every Zoom credential for it goes, including one
+// an earlier disconnect left behind. A reconnect rewrites both rows, so rows
+// written after the deauthorization belong to a newer grant and stay, even
+// when this notice arrives late or is retried.
+export const removeDeauthorizedZoomUser = Effect.fn(
+ "conferencing.removeDeauthorizedZoomUser",
+)(function* ({
+ zoomUserId,
+ deauthorizedAt,
+}: {
+ zoomUserId: string;
+ deauthorizedAt: Date;
+}) {
+ const revoked = {
+ provider: "zoom",
+ providerAccountId: zoomUserId,
+ updatedAt: { lte: deauthorizedAt },
+ };
+ const [connections, credentials] = yield* fromPrisma(() =>
+ prisma.$transaction([
+ prisma.conferencingConnection.deleteMany({ where: revoked }),
+ prisma.credential.deleteMany({
+ where: {
+ ...revoked,
+ calendarConnections: { none: {} },
+ conferencingConnections: { none: {} },
+ },
+ }),
+ ]),
+ );
+ return {
+ removedConnections: connections.count,
+ removedCredentials: credentials.count,
+ };
+});
diff --git a/apps/web/src/features/conferencing/schema.ts b/apps/web/src/features/conferencing/schema.ts
index 50cb61de6..ce4fd73b0 100644
--- a/apps/web/src/features/conferencing/schema.ts
+++ b/apps/web/src/features/conferencing/schema.ts
@@ -50,3 +50,19 @@ export const conferencingSchema = z.discriminatedUnion("provider", [
]);
export type Conferencing = z.infer<typeof conferencingSchema>;
+
+// A Zoom event notification. The payload is parsed per event, so an event
+// this app does not handle is acknowledged rather than rejected.
+export const zoomWebhookEventSchema = z.object({
+ event: z.string(),
+ payload: z.unknown(),
+});
+
+export const zoomUrlValidationPayloadSchema = z.object({
+ plainToken: z.string().min(1),
+});
+
+export const zoomDeauthorizationPayloadSchema = z.object({
+ user_id: z.string().min(1),
+ deauthorization_time: z.iso.datetime(),
+});
diff --git a/apps/web/src/features/conferencing/utils.test.ts b/apps/web/src/features/conferencing/utils.test.ts
index f48069504..6888c3d00 100644
--- a/apps/web/src/features/conferencing/utils.test.ts
+++ b/apps/web/src/features/conferencing/utils.test.ts
@@ -1,9 +1,12 @@
+import { createHmac } from "node:crypto";
import { describe, expect, it } from "vitest";
import { conferencingSchema } from "./schema";
import {
+ createZoomUrlValidationResponse,
getConferencingUri,
meetSpaceResponseSchema,
meetSpaceToConferencing,
+ verifyZoomWebhookSignature,
zoomMeetingResponseSchema,
zoomMeetingToConferencing,
} from "./utils";
@@ -66,3 +69,89 @@ describe("meetSpaceToConferencing", () => {
).toBe(false);
});
});
+
+describe("verifyZoomWebhookSignature", () => {
+ const secretToken = "zoom-secret-token";
+ const body = JSON.stringify({ event: "app_deauthorized" });
+ const now = new Date("2026-09-26T12:00:00Z");
+ const timestamp = String(now.getTime() / 1000);
+ const sign = (message: string) =>
+ `v0=${createHmac("sha256", secretToken).update(message).digest("hex")}`;
+
+ it("accepts a request Zoom signed", async () => {
+ await expect(
+ verifyZoomWebhookSignature({
+ secretToken,
+ signature: sign(`v0:${timestamp}:${body}`),
+ timestamp,
+ body,
+ now,
+ }),
+ ).resolves.toEqual({ ok: true });
+ });
+
+ it("rejects a body changed after signing", async () => {
+ await expect(
+ verifyZoomWebhookSignature({
+ secretToken,
+ signature: sign(`v0:${timestamp}:${body}`),
+ timestamp,
+ body: body.replace("app_deauthorized", "something_else"),
+ now,
+ }),
+ ).resolves.toEqual({ ok: false, reason: "invalid_signature" });
+ });
+
+ it("rejects a signature that is not hex", async () => {
+ await expect(
+ verifyZoomWebhookSignature({
+ secretToken,
+ signature: "v0=not-hex",
+ timestamp,
+ body,
+ now,
+ }),
+ ).resolves.toEqual({ ok: false, reason: "invalid_signature" });
+ });
+
+ it("rejects a timestamp more than five minutes away", async () => {
+ const stale = String(now.getTime() / 1000 - 301);
+ await expect(
+ verifyZoomWebhookSignature({
+ secretToken,
+ signature: sign(`v0:${stale}:${body}`),
+ timestamp: stale,
+ body,
+ now,
+ }),
+ ).resolves.toEqual({ ok: false, reason: "stale" });
+ });
+
+ it("rejects a request without the signing headers", async () => {
+ await expect(
+ verifyZoomWebhookSignature({
+ secretToken,
+ signature: null,
+ timestamp,
+ body,
+ now,
+ }),
+ ).resolves.toEqual({ ok: false, reason: "missing_headers" });
+ });
+});
+
+describe("createZoomUrlValidationResponse", () => {
+ it("returns the plain token with its hex HMAC", async () => {
+ await expect(
+ createZoomUrlValidationResponse({
+ secretToken: "zoom-secret-token",
+ plainToken: "qgg8vlvZRS6UYooatFL8Aw",
+ }),
+ ).resolves.toEqual({
+ plainToken: "qgg8vlvZRS6UYooatFL8Aw",
+ encryptedToken: createHmac("sha256", "zoom-secret-token")
+ .update("qgg8vlvZRS6UYooatFL8Aw")
+ .digest("hex"),
+ });
+ });
+});
diff --git a/apps/web/src/features/conferencing/utils.ts b/apps/web/src/features/conferencing/utils.ts
index d3f5e58fe..1d06246be 100644
--- a/apps/web/src/features/conferencing/utils.ts
+++ b/apps/web/src/features/conferencing/utils.ts
@@ -86,3 +86,96 @@ export function moderatedLinkText(uri: string | undefined) {
return uri;
}
}
+
+// How long a captured, correctly signed request stays replayable.
+const ZOOM_WEBHOOK_TOLERANCE_MS = 5 * 60_000;
+
+const encoder = new TextEncoder();
+
+function importHmacKey(secretToken: string) {
+ return crypto.subtle.importKey(
+ "raw",
+ encoder.encode(secretToken),
+ { name: "HMAC", hash: "SHA-256" },
+ false,
+ ["sign", "verify"],
+ );
+}
+
+function fromHex(hex: string) {
+ if (!/^(?:[0-9a-f]{2})+$/i.test(hex)) {
+ return null;
+ }
+ const bytes = new Uint8Array(hex.length / 2);
+ for (let i = 0; i < bytes.length; i++) {
+ bytes[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
+ }
+ return bytes;
+}
+
+function toHex(buffer: ArrayBuffer) {
+ return Array.from(new Uint8Array(buffer))
+ .map((byte) => byte.toString(16).padStart(2, "0"))
+ .join("");
+}
+
+// Zoom signs every event notification with the app's Secret Token:
+// `v0=` + hex HMAC-SHA256 of `v0:{x-zm-request-timestamp}:{raw body}`, the
+// timestamp in seconds.
+export async function verifyZoomWebhookSignature({
+ secretToken,
+ signature,
+ timestamp,
+ body,
+ now,
+}: {
+ secretToken: string;
+ signature: string | null;
+ timestamp: string | null;
+ body: string;
+ now: Date;
+}): Promise<
+ | { ok: true }
+ | { ok: false; reason: "missing_headers" | "stale" | "invalid_signature" }
+> {
+ if (!signature || !timestamp || !/^\d+$/.test(timestamp)) {
+ return { ok: false, reason: "missing_headers" };
+ }
+ if (
+ Math.abs(now.getTime() - Number(timestamp) * 1000) >
+ ZOOM_WEBHOOK_TOLERANCE_MS
+ ) {
+ return { ok: false, reason: "stale" };
+ }
+ const expected = signature.startsWith("v0=")
+ ? fromHex(signature.slice(3))
+ : null;
+ // `verify` compares in constant time, unlike comparing hex strings.
+ const valid =
+ expected !== null &&
+ (await crypto.subtle.verify(
+ "HMAC",
+ await importHmacKey(secretToken),
+ expected,
+ encoder.encode(`v0:${timestamp}:${body}`),
+ ));
+ return valid ? { ok: true } : { ok: false, reason: "invalid_signature" };
+}
+
+// The answer to the challenge Zoom sends when the endpoint URL is saved.
+export async function createZoomUrlValidationResponse({
+ secretToken,
+ plainToken,
+}: {
+ secretToken: string;
+ plainToken: string;
+}) {
+ const encryptedToken = toHex(
+ await crypto.subtle.sign(
+ "HMAC",
+ await importHmacKey(secretToken),
+ encoder.encode(plainToken),
+ ),
+ );
+ return { plainToken, encryptedToken };
+}
diff --git a/apps/web/tests/zoom-deauthorization.spec.ts b/apps/web/tests/zoom-deauthorization.spec.ts
new file mode 100644
index 000000000..358bf39ee
--- /dev/null
+++ b/apps/web/tests/zoom-deauthorization.spec.ts
@@ -0,0 +1,218 @@
+import { createHmac } from "node:crypto";
+import type { APIRequestContext } from "@playwright/test";
+import { expect, test } from "@playwright/test";
+import { prisma } from "@rallly/database";
+import { createUserInDb } from "./test-utils";
+
+const runId = Date.now().toString(36);
+const endpoint = "/api/integrations/zoom/deauthorize";
+
+function sign({ body, timestamp }: { body: string; timestamp: string }) {
+ const secretToken = process.env.ZOOM_WEBHOOK_SECRET_TOKEN;
+ if (!secretToken) {
+ throw new Error("ZOOM_WEBHOOK_SECRET_TOKEN is required to sign events");
+ }
+ return `v0=${createHmac("sha256", secretToken)
+ .update(`v0:${timestamp}:${body}`)
+ .digest("hex")}`;
+}
+
+async function postZoomEvent(
+ request: APIRequestContext,
+ payload: unknown,
+ { signature }: { signature?: string } = {},
+) {
+ const body = JSON.stringify(payload);
+ const timestamp = Math.floor(Date.now() / 1000).toString();
+ return request.post(endpoint, {
+ data: body,
+ headers: {
+ "content-type": "application/json",
+ "x-zm-request-timestamp": timestamp,
+ "x-zm-signature": signature ?? sign({ body, timestamp }),
+ },
+ });
+}
+
+async function seedZoomConnection({
+ userId,
+ zoomUserId,
+}: {
+ userId: string;
+ zoomUserId: string;
+}) {
+ const credential = await prisma.credential.create({
+ data: {
+ userId,
+ provider: "zoom",
+ providerAccountId: zoomUserId,
+ type: "OAUTH",
+ secret: "encrypted",
+ scopes: ["meeting:write:meeting"],
+ },
+ });
+ await prisma.conferencingConnection.create({
+ data: {
+ userId,
+ provider: "zoom",
+ integrationId: "zoom",
+ providerAccountId: zoomUserId,
+ email: `organizer-${runId}@zoom.example`,
+ displayName: "Zoom",
+ credentialId: credential.id,
+ },
+ });
+}
+
+async function countZoomRows(zoomUserId: string) {
+ const where = { provider: "zoom", providerAccountId: zoomUserId };
+ return {
+ connections: await prisma.conferencingConnection.count({ where }),
+ credentials: await prisma.credential.count({ where }),
+ };
+}
+
+test.describe("Zoom deauthorization endpoint", () => {
+ const zoomUserId = `zoom-user-${runId}`;
+ let userIds: string[] = [];
+
+ test.beforeEach(async () => {
+ const users = await Promise.all(
+ ["a", "b"].map((suffix) =>
+ createUserInDb({
+ email: `zoom-deauth-${suffix}-${runId}@example.com`,
+ name: "Organizer",
+ }),
+ ),
+ );
+ userIds = users.map((user) => user.id);
+ for (const userId of userIds) {
+ await seedZoomConnection({ userId, zoomUserId });
+ }
+ });
+
+ test.afterEach(async () => {
+ await prisma.user.deleteMany({ where: { id: { in: userIds } } });
+ });
+
+ test("answers the URL validation challenge", async ({ request }) => {
+ const res = await postZoomEvent(request, {
+ event: "endpoint.url_validation",
+ event_ts: Date.now(),
+ payload: { plainToken: "qgg8vlvZRS6UYooatFL8Aw" },
+ });
+ expect(res.status()).toBe(200);
+ expect(await res.json()).toEqual({
+ plainToken: "qgg8vlvZRS6UYooatFL8Aw",
+ encryptedToken: createHmac(
+ "sha256",
+ process.env.ZOOM_WEBHOOK_SECRET_TOKEN ?? "",
+ )
+ .update("qgg8vlvZRS6UYooatFL8Aw")
+ .digest("hex"),
+ });
+ });
+
+ test("a mis-signed event gets 401 and changes nothing", async ({
+ request,
+ }) => {
+ const res = await postZoomEvent(
+ request,
+ {
+ event: "app_deauthorized",
+ payload: { user_id: zoomUserId, account_id: "account" },
+ },
+ { signature: `v0=${"0".repeat(64)}` },
+ );
+ expect(res.status()).toBe(401);
+ expect(await countZoomRows(zoomUserId)).toEqual({
+ connections: 2,
+ credentials: 2,
+ });
+ });
+
+ test("a signed app_deauthorized event removes every connection and credential for that Zoom user, orphaned ones included", async ({
+ request,
+ }) => {
+ const otherZoomUserId = `other-zoom-user-${runId}`;
+ await seedZoomConnection({
+ userId: userIds[0],
+ zoomUserId: otherZoomUserId,
+ });
+ // What a disconnect used to leave behind: the credential without its
+ // connection.
+ await prisma.conferencingConnection.deleteMany({
+ where: { userId: userIds[1] },
+ });
+
+ const res = await postZoomEvent(request, {
+ event: "app_deauthorized",
+ event_ts: Date.now(),
+ payload: {
+ account_id: "account",
+ user_id: zoomUserId,
+ signature: "unused",
+ deauthorization_time: new Date().toISOString(),
+ client_id: "test-zoom",
+ },
+ });
+ expect(res.status()).toBe(200);
+ expect(await countZoomRows(zoomUserId)).toEqual({
+ connections: 0,
+ credentials: 0,
+ });
+ expect(await countZoomRows(otherZoomUserId)).toEqual({
+ connections: 1,
+ credentials: 1,
+ });
+ });
+
+ test("a late event keeps a connection made after the deauthorization", async ({
+ request,
+ }) => {
+ const deauthorizedAt = new Date(Date.now() - 60_000);
+ // Only the second user's rows predate the deauthorization; the first
+ // user reconnected since, which rewrote theirs.
+ const before = { updatedAt: new Date(deauthorizedAt.getTime() - 60_000) };
+ await prisma.conferencingConnection.updateMany({
+ where: { userId: userIds[1] },
+ data: before,
+ });
+ await prisma.credential.updateMany({
+ where: { userId: userIds[1] },
+ data: before,
+ });
+
+ const res = await postZoomEvent(request, {
+ event: "app_deauthorized",
+ payload: {
+ user_id: zoomUserId,
+ deauthorization_time: deauthorizedAt.toISOString(),
+ },
+ });
+ expect(res.status()).toBe(200);
+ expect(await countZoomRows(zoomUserId)).toEqual({
+ connections: 1,
+ credentials: 1,
+ });
+ expect(
+ await prisma.conferencingConnection.count({
+ where: { userId: userIds[0] },
+ }),
+ ).toBe(1);
+ });
+
+ test("an event for an unknown Zoom user is still acknowledged", async ({
+ request,
+ }) => {
+ const res = await postZoomEvent(request, {
+ event: "app_deauthorized",
+ payload: {
+ account_id: "account",
+ user_id: `unknown-${runId}`,
+ deauthorization_time: new Date().toISOString(),
+ },
+ });
+ expect(res.status()).toBe(200);
+ });
+});