Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
zoom-meeting-sdk back-end
require('dotenv').config();
const KJUR = require('jsrsasign')
const crypto = require('crypto') // crypto comes with Node.js
function generateSignatureSdk(apiKey, apiSecret, meetingNumber, role) {
const iat = Math.round((new Date().getTime() - 30000) / 1000)
const exp = iat + 60 * 60 * 2 * 1000;
const oHeader = { alg: 'HS256', typ: 'JWT' }
const oPayload = {
sdkKey: process.env.ZOOM_SDK_KEY,
mn: meetingNumber,
role: role,
iat: iat,
exp: exp,
appKey: process.env.ZOOM_SDK_KEY,
tokenExp: iat + 60 * 60 * 2 * 1000
}
const sHeader = JSON.stringify(oHeader)
const sPayload = JSON.stringify(oPayload)
const signature = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, apiSecret)
return signature;
}
// pass in your Zoom JWT API Key, Zoom JWT API Secret, Zoom Meeting Number, and 0 to join meeting or webinar or 1 to start meeting
console.log(generateSignatureSdk(process.env.ZOOM_SDK_KEY, process.env.ZOOM_SDK_SECRET, 87270695528, 0))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment