How to solve problem with oAuth Zoom in Nextjs?

I am trying to authenicat the user inorder to get data to use to create or update meetings later. but it full of errors. Here I am sending Post request in order to get the AccessToken and then get the userData as Props.

export async function getServerSideProps(res){

const oauth = async() => {
     const zoomUserData = [];
       const b = Buffer.from(process.env.ZOOM_API_KEY + ":" + process.env.ZOOM_API_SECRET);

 const zoomRes = await fetch(`${req.body.code}&redirect_uri=${process.env.ZOOM_REDIRECT_URL}`, {
   method: "POST",
   headers: {
     Authorization: `Basic ${b.toString("base64")}`,
 const zoomData = await zoomRes.json();
 const zoomUserRes = await fetch("", {
   method: "GET",
   headers: {
     Authorization: `Bearer ${zoomData.access_token}`,
 const zoomUserData = await zoomUserRes.json();

   Encrypt and store below details to your database:
     zoomData.expires_in // convert it to time by adding these seconds to current time



and then i am passing the props to a page component like that :

export default function Meeting({zoomUserData}) { 
  const router = useRouter();  
      useEffect(() => {    
         if (router.query.code) { 
              { method: 'POST',
         headers: {
           'ContType': 'application/json',
         body: JSON.stringify({ code: router.query.code }),
       }).then(() => {
       }).catch(() => {
   }, [router.query.code]);

   return (

     <a href={`${process.env.ZOOM_API_KEY}&redirect_uri=${process.env.ZOOM_REDIRECT_URL}`}>
       Connect Zoom


Hi @Kanwal_Aftab

Thank you for reaching out to the Zoom Developer Forum, I am happy to help here!
Have you tried making this request via Postman and confirm that you are getting the response you are looking for?

You forget to mention what Error are you getting? So it would be helpful to explain the mistake.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.