fix google auth callback (#500)

* maybe fix?

* fix

* Update pages/api/integrations/googlecalendar/callback.ts

Co-authored-by: Alex Johansson <alexander@n1s.se>

Co-authored-by: Alex van Andel <me@alexvanandel.com>
pull/442/head
Alex Johansson 2021-08-19 16:37:18 +02:00 committed by GitHub
parent f8a3f73a25
commit 6d158e0c50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -23,11 +23,11 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
const { client_secret, client_id, redirect_uris } = JSON.parse(credentials).web;
const oAuth2Client = new google.auth.OAuth2(client_id, client_secret, redirect_uris[0]);
const token = await oAuth2Client.getToken(code);
const key = token.res?.data;
await prisma.credential.create({
data: {
type: "google_calendar",
key: token as any,
key,
userId: session.user.id,
},
});