Signature has Expired

Hi ,

  1. 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.

  2. 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.

  3. The account which I am using (The API key and the Secret Key) are of purchased account.

  4. I have gone through all the post related to the signature has expired and tried to implement them but still the issue persist.

  5. 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.

Please help me in resolving this issue.

1 Like

Looking forward for a solution, too!

@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;
}
1 Like

Thanks,
However I’m generating the signature server side and render it to the page:

$(function(){
      ZoomMtg.init({
          leaveUrl: 'http://mysite.com',
          isSupportAV: true,
          success: function () {
              ZoomMtg.join(
                  {
                      meetingNumber: <%=meeting_number%>,
                      userName: '<%=user.email%>',
                      userEmail: '<%=user.email%>',
                      signature: '<%=signature%>',
                      apiKey: '<%=config.get('zoom.api_key')%>',
                      success: function(res){
                          console.log('join meeting success');
                      },
                      error: function(err){
                        console.log(err)
                      }
                  }
              );
          }
      });
    })

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?

it’s a bad way to generate signatures on the browser side. We haven’t found the root cause.


here is sample code generated signatures on server side.

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!

1 Like

To see code samples and a sample app to generate the Web SDK Signature, checkout our docs:

Thanks,
Tommy