From 6d8fbfc49a7916ad05e9c49ccee3c37860fa816e Mon Sep 17 00:00:00 2001 From: Morgan <33722304+ThyMinimalDev@users.noreply.github.com> Date: Thu, 9 May 2024 17:08:31 +0300 Subject: [PATCH] fix: gcal save get credentials from token.tokens (#14962) --- apps/api/v2/src/ee/gcal/gcal.controller.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/api/v2/src/ee/gcal/gcal.controller.ts b/apps/api/v2/src/ee/gcal/gcal.controller.ts index 962133d08f..acb7ac5510 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 );