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

This commit is contained in:
Morgan
2024-05-09 14:08:31 +00:00
committed by GitHub
parent 304ef29618
commit 6d8fbfc49a
+4 -2
View File
@@ -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
);