Very rudimentary development version of zoom auth #3
This commit is contained in:
parent
a2f1462f10
commit
46474c9c70
1 changed files with 14 additions and 18 deletions
|
@ -1,6 +1,5 @@
|
||||||
import type {NextApiRequest, NextApiResponse} from 'next';
|
import type {NextApiRequest, NextApiResponse} from 'next';
|
||||||
import {getSession} from "next-auth/client";
|
import {getSession} from "next-auth/client";
|
||||||
import prisma from "../../../../lib/prisma";
|
|
||||||
|
|
||||||
const client_id = process.env.ZOOM_CLIENT_ID;
|
const client_id = process.env.ZOOM_CLIENT_ID;
|
||||||
const client_secret = process.env.ZOOM_CLIENT_SECRET;
|
const client_secret = process.env.ZOOM_CLIENT_SECRET;
|
||||||
|
@ -32,22 +31,19 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return new Promise( (resolve, reject) => fetch('https://zoom.us/oauth/token', options)
|
return new Promise( async (resolve, reject) => {
|
||||||
.then((res) => res.text())
|
const result = await fetch('https://zoom.us/oauth/token', options);
|
||||||
.then((text) => {
|
console.log(result);
|
||||||
console.log(text);
|
|
||||||
const credential = await prisma.credential.create({
|
/*const credential = await prisma.credential.create({
|
||||||
data: {
|
data: {
|
||||||
type: 'google_calendar',
|
type: 'google_calendar',
|
||||||
key: 'lel',
|
key: 'lel',
|
||||||
userId: session.user.id
|
userId: session.user.id
|
||||||
}
|
}
|
||||||
});
|
});*/
|
||||||
|
|
||||||
res.redirect('/integrations');
|
res.redirect('/integrations');
|
||||||
resolve();
|
resolve();
|
||||||
})
|
});
|
||||||
.catch((err) => {
|
|
||||||
if (err) throw new Error(err);
|
|
||||||
}));
|
|
||||||
}
|
}
|
Loading…
Reference in a new issue