I am getting this error that the signature has expired.Some times it works like a charm ,But some time it show me msg that signature has expired.It is happening on the same system, same browser.
On some people system it works but on some people system it don’t works and show me an error that the signature has expired.
The account which I am using (The API key and the Secret Key) are of purchased account.
I have gone through all the post related to the signature has expired and tried to implement them but still the issue persist.
I cannot deploy this integration on production because this error can occurs on the client system as well and it will be a blocker for me.
@Class_11@shahar
Sorry about that. this issue because of the time. the first sync system time. Try to use success callback fun to ensure signature generate success.
ZoomMtg.generateSignature({
meetingNumber: meetConfig.meetingNumber,
apiKey: meetConfig.apiKey,
apiSecret: meetConfig.apiSecret,
role: meetConfig.role,
success(res) {
console.log('signature', res.result);
ZoomMtg.init({
leaveUrl: 'http://www.zoom.us',
success() {
ZoomMtg.join(
{
meetingNumber: meetConfig.meetingNumber,
userName: meetConfig.userName,
signature: res.result,
apiKey: meetConfig.apiKey,
userEmail: '',
passWord: '',
success() {
console.log('join meeting success');
},
error(res) {
console.log(res);
}
}
);
},
error(res) {
console.log(res);
}
});
}
});
// here is a simple code generateSignature with es6 statements
// npm install --save-dev js-base64 crypto-js
import * as base64JS from 'js-base64';
import * as hmacSha256 from 'crypto-js/hmac-sha256';
import * as encBase64 from 'crypto-js/enc-base64';
function generateSignature(data) {
let signature = '';
const ts = new Date().getTime();
try {
const msg = base64JS.Base64.encode(data.apiKey + data.meetingNumber + ts + data.role);
const hash = hmacSha256.default(msg, data.apiSecret);
signature = base64JS.Base64.encodeURI(`${data.apiKey}.${data.meetingNumber}.${ts}.${data.role}.${encBase64.stringify(hash)}`);
} catch (e) {
console.log('error');
}
return signature;
}
So I do I imply the same method you mentioned on server generated signatures? or another solution? and what exactly is the problem with the time, just curious?
I underdtand that and I’m already generating signatures on the server side, no problem with that. My question is how to overcome the “signature expired” bug when generating the signature server side.
I saw a small hint of something in what @JackYang wrote:
Sorry about that. this issue because of the time. the first sync system time.
I tried passing the epoch time of the browser back to my API that’s doing generateSignature() (e.g. instead of generating the time in epochs in the backend, I pass what the browser has back to it), and that got it working!