I am using Zoom Meeting API to create a react based web app in which I need to schedule zoom meeting but while testing my endpoint on postman it shows
{
“code”: 124,
“message”: “Invalid access token.”
}
and can anyone provide me correct header snippet for the api call and I have 3 credentials in my Server-To-Server OAuth app which are Account Id, Client Id, Client secret, so which one should be used for auth token.
Hi @practicereactjswithf
Thanks for reaching out to the Zoon Developer Forum and welcome to our community!
Can you please share with me how you are making your request so I can take a look at it
Also, make sure that your Server to Server oauth app has the right scopes added to it so you can reach that endpoint
import axios from ‘axios’;
import { NextResponse } from “next/server”;
export async function POST(
request: Request
) {
const body = await request.json();
const {
startTime,
endTime
} = body;
const userId = ‘practicereactjswithfirebase@gmail.com’; // Replace with the actual user ID or email
const meeting = {
topic: ‘My Meeting’,
start_time: new Date(startTime).toISOString(),
end_time: new Date(endTime).toISOString(),
type: 2,
settings: {
join_before_host: true,
approval_type: 0,
audio: ‘telephony’,
meeting_authentication: true,
},
};
try {
const response = await axios.post(
https://api.zoom.us/users/${userId}/meetings
,
meeting,
{
headers: {
‘Content-Type’: ‘application/json’,
‘Authorization’: ‘Bearer CDQ1xWNcRJCm9Od6RxNpEg’,
},
}
);
NextResponse.json(response);
} catch (error) {
console.log(error);
return NextResponse.json(error);
}
}
Thanks for sharing this, but I was talking about the request to get your access token @practicereactjswithf
Could you share that with me please
Actually was not using any access token here because I haven’t went through Using Zoom APIs . I was directly using Zoom Meeting API to create meeting link, so now it is working fine.
Thnaks.