Topic:Web sdk integration in React JS - JWT migration to SDK
We are using jwt credentials for integrating zoom web sdk in react application, but using jwt details web sdk not working and we tried to create Meeting SDK and we are using sdk credentails for Web sdk integration.
As a host web sdk is working but as a participant it is not working, i am attaching error screen, please check.
And also following is the code for web sdk integration, please check and let me know any issues from my side.
And also please check created sdk app settings in account, is we created correctly or not.
import { ZoomMtg } from ‘@zoomus/websdk’;
import { useUser } from ‘hooks/index’;
ZoomMtg.setZoomJSLib(‘https://source.zoom.us/lib’, ‘/av’);
ZoomMtg.preLoadWasm();
ZoomMtg.prepareWebSDK();
// loads language files, also passes any error messages to the ui
ZoomMtg.i18n.load(‘en-US’);
ZoomMtg.i18n.reload(‘en-US’);
const signature = ZoomMtg.generateSDKSignature({
meetingNumber: meetingData?.id,
sdkKey: sdkKey,
sdkSecret: sdkSecret,
role: meetingData?.role,
});
//for participant
ZoomMtg.join({
meetingNumber: meetingData?.id,
userName: userLoggedIn?.fullName,
signature: signature,
sdkKey: sdkKey,
userEmail: userLoggedIn?.email,
passWord: passWord,
tk: params[1],
meetingInfo: ,
success: () => {
showToastSuccess(‘Joined meeting successfully’);
},
error: (error) => {
console.log(error);
showToastError(error);
},
});
//For instructor
ZoomMtg.join({
meetingNumber: meetingData?.id,
userName: userLoggedIn?.fullName,
signature: signature,
sdkKey: sdkKey,
userEmail: userLoggedIn?.email,
passWord: passWord,
success() {
showToastSuccess(‘Meeting started successfully’);
},
error(res) {
console.log(res);
showToastError(res);
},
});
//signature generating in node js also
const sdkKey = ‘c6XoxxxxxxxxxxxX’;
const sdkSecret = ‘pwlIxxxxxxxxxxxxxxY’;
const iat = Math.round(new Date().getTime() / 1000) - 30;
const exp = iat + 60 * 60 * 2;
const oHeader = { alg: ‘HS256’, typ: ‘JWT’ };
const oPayload = {
sdkKey: sdkKey,
mn: meetingNumber,
role: role,
iat: iat,
exp: exp,
appKey: sdkKey,
tokenExp: iat + 60 * 60 * 2,
};
const sHeader = JSON.stringify(oHeader);
const sPayload = JSON.stringify(oPayload);
signature = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, sdkSecret)
Please resolve it ASAP.
Thanks,
Mindchamps Team.