Skip to content

Scheduling infrastructure for absolutely everyone.

fix: gcal save get credentials from token.tokens (#14962)

Morgan6d8fbfc49a79
diff --git a/apps/api/v2/src/ee/gcal/gcal.controller.ts b/apps/api/v2/src/ee/gcal/gcal.controller.ts
index 962133d08f0..acb7ac5510a 100644
--- a/apps/api/v2/src/ee/gcal/gcal.controller.ts
+++ b/apps/api/v2/src/ee/gcal/gcal.controller.ts
@@ -26,6 +26,7 @@ import {
} from "@nestjs/common";
import { ConfigService } from "@nestjs/config";
import { ApiTags as DocsTags } from "@nestjs/swagger";
+import { Prisma } from "@prisma/client";
import { Request } from "express";
import { google } from "googleapis";
import { z } from "zod";
@@ -106,10 +107,11 @@ export class GcalController {
const oAuth2Client = await this.gcalService.getOAuthClient(this.redirectUri);
const token = await oAuth2Client.getToken(parsedCode);
- const key = token.res?.data;
+ // Google oAuth Credentials are stored in token.tokens
+ const key = token.tokens;
const credential = await this.credentialRepository.createAppCredential(
GOOGLE_CALENDAR_TYPE,
- key,
+ key as Prisma.InputJsonValue,
ownerId
);