Code:124 Invalid Access Token Error

Hi team,

I’m facing the error “Invalid access token” while trying to create a new meeting via the API.I am using jsonwebtoken to create authToken using sdk key and sdk secret , when I attempt to create a meeting using this token through the following endpoint I receive the above error message. I’m unsure how to resolve this issue.

async generateToken() {
return await jwt.sign({
iss: apiKeys.zoomJwtApiKey
},
apiKeys.zoomJwtApiSecret, {
algorithm: “HS256”,
expiresIn: 120
}
);
}

async createEvent(request) {
let jwtToken = await this.generateToken();
let startDate = request.date.split(“T”)[0] + “T” + request.time + “:00”;
var options = {
method: “POST”,
uri: “https://api.zoom.us/v2/users/” + apiKeys.zoomAccountMail + “/meetings”,
body: {
topic: request.ad.title,
type: 2,
startTime: startDate,
duration: 60,
timezone: “Asia/Tashkent”,
agenda: request.ad.title,
settings: {
join_before_host: “true”,
jbh_time: 10,
waiting_room: false,
},
},
auth: {
bearer: jwtToken,
},
headers: {
“User-Agent”: “Zoom-api-Jwt-Request”,
“content-type”: “application/json”,
},
json: true,
};

return await rp(options);

}

@iampentext ,

To call the REST API, you need to either use the Server to Server OAuth App or OAuth App.

You cannot use SDK Key and SDK Secret as they are only used for SDK Authentication.

Please tag me in your response