From f44c8b6326771f8244800c9a80be85fc40c70a78 Mon Sep 17 00:00:00 2001 From: nicolas Date: Fri, 11 Jun 2021 02:14:36 +0200 Subject: [PATCH] Potentially first working version of token fetching for zoom --- pages/api/integrations/zoom/callback.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/api/integrations/zoom/callback.ts b/pages/api/integrations/zoom/callback.ts index 438ca252..9f26f2de 100644 --- a/pages/api/integrations/zoom/callback.ts +++ b/pages/api/integrations/zoom/callback.ts @@ -1,5 +1,6 @@ import type {NextApiRequest, NextApiResponse} from 'next'; import {getSession} from "next-auth/client"; +import prisma from "../../../../lib/prisma"; const client_id = process.env.ZOOM_CLIENT_ID; const client_secret = process.env.ZOOM_CLIENT_SECRET; @@ -25,16 +26,15 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) Authorization: authHeader } }) - .then(res => res.text()); - console.log(result); + .then(res => res.json()); - /*const credential = await prisma.credential.create({ + const credential = await prisma.credential.create({ data: { - type: 'google_calendar', - key: 'lel', + type: 'zoom', + key: result.access_token, userId: session.user.id } - });*/ + }); res.redirect('/integrations'); resolve();