# \[Web SDK\] Random "Joining meeting timeout. Signature is invalid" error

**URL:** <https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866>\
**Category:** Web\
**Created:** [July 22, 2020, 12:20pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866 "2020-07-22T12:20:33Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![onboardu](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/onboardu/32/12278_2.png) [@onboardu](https://devforum.zoom.us/u/onboardu)\
**Post date:** [July 22, 2020, 12:20pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/1 "2020-07-22T12:20:33Z")

</div>

**Description**  
We are trying to integrate Zoom into our application using Web SDK and only one issue has not resolved yet. We faced with “Joining meeting timeout. Signature is invalid” randomly on both of our environments (development and staging). After clicking several times on “retry” button user is able to join to the meeting successfully. It occurs for every meeting for any user. We were able to find several opened issues in your devforum but they were not very helpful (Clock sync was suggested as a solution. But clock is synchronized in our environments for sure because we had sync clock issue with other integration). Could you help as to figure out what is the reason of this randomly occurred error? We are using ruby language to generate signature using the code snippet provided in your documentation and JWT zoom application for integration

Thank you.

**Error**  
Joining meeting timeout. Signature is invalid

**Which version?**  
We are using CDN solution. The version is 1.7.9.

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:

1. Initiate joining to the meeting using JS (ZoomMtg.join method)
2. User sees an error message ‘Joining meeting timeout. Signature is invalid’
3. Click retry several times
4. User is successfully joined to the meeting.

**Laptop (please complete the following information):**

- Does not matter. It is reproducible in different devices and different OS

**Additional context**  
Tried to use other possible variations of signature generation. Tried to use UTC timezone explicitly. Both of this actions did not resolve the problem.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 24, 2020, 6:18pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/3 "2020-07-24T18:18:42Z")

</div>

Hey @onboardu,

Can you please share your [Web SDK signature](https://marketplace.zoom.us/docs/sdk/native-sdks/web/essential/signature) that is throwing this error to [developersupport@zoom.us](mailto:developersupport@zoom.us) so I can debug it?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![onboardu](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/onboardu/32/12278_2.png) [@onboardu](https://devforum.zoom.us/u/onboardu)\
**Post date:** [July 25, 2020, 12:32am UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/4 "2020-07-25T00:32:48Z")

</div>

Hi Tommy,

Here is invalid signature received after first attempt to join the meeting (after two retries I was able to join the meeting using another signature):

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 28, 2020, 4:38pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/5 "2020-07-28T16:38:38Z")

</div>

Hey @onboardu,

Are you still having issues then?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![onboardu](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/onboardu/32/12278_2.png) [@onboardu](https://devforum.zoom.us/u/onboardu)\
**Post date:** [July 29, 2020, 10:34am UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/6 "2020-07-29T10:34:10Z")

</div>

Hi @tommy ,

Yes we are. Every time when we try to join to the meeting, we have to make 3 or more retries until successful join.

---

<div class="post-metadata">

**Author:** ![abiyani](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/abiyani/32/6373_2.png) [@abiyani](https://devforum.zoom.us/u/abiyani)\
**Post date:** [July 29, 2020, 6:48pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/7 "2020-07-29T18:48:32Z")

</div>

Hi @onboardu and @tommy,

I actually noticed that the sample Ruby code nearly always generates this error for me. I adapted the following code from another forum post a while back (can’t find the link right now), and it’s been working consistently:

```
require "base64"

module SignatureRoles
  PARTICIPANT = 0
  HOST = 1
end

def generate_signature(meeting_id:)
  # Prevent time sync issue between client signature generation and Zoom
  timestamp = (Time.now.to_f * 1000).round(0) - 30000

  role = <logic for host or participant> ? SignatureRoles::HOST : SignatureRoles::PARTICIPANT
  key = Rails.application.config.zoom.api_key
  secret = Rails.application.config.zoom.api_secret

  message = Base64.strict_encode64([key, meeting_id, timestamp, role].join)
  hash = Base64.strict_encode64(OpenSSL::HMAC.digest("SHA256", secret, message))

  Base64.strict_encode64([key, meeting_id, timestamp, role, hash].join("."))
end

```

Hope this helps!

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 31, 2020, 5:30pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/8 "2020-07-31T17:30:21Z")

</div>

Hey @onboardu,

Just FYI, you are passing role `1` into the Web SDK signature which means you are trying to start the meeting. If you are trying to join the meeting, try passing in role `0` and let me know if that fixes the issue.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 31, 2020, 5:30pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/9 "2020-07-31T17:30:54Z")

</div>

Hey @abiyani,

Thanks for sharing this. We will reanalyze the Ruby sample code. 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![onboardu](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/onboardu/32/12278_2.png) [@onboardu](https://devforum.zoom.us/u/onboardu)\
**Post date:** [August 2, 2020, 10:09am UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/11 "2020-08-02T10:09:30Z")

</div>

@abiyani Thanks so much! It works!

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 3, 2020, 8:10pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/13 "2020-08-03T20:10:44Z")

</div>

Happy to hear that is working! 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![cnadeau](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cnadeau/32/5141_2.png) [@cnadeau](https://devforum.zoom.us/u/cnadeau)\
**Post date:** [August 7, 2020, 7:49pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/14 "2020-08-07T19:49:30Z")

</div>

The problem is that ruby doesn’t use the same aphabet:

[https://ruby-doc.org/stdlib-2.5.3/libdoc/base64/rdoc/Base64.html#method-i-urlsafe\_encode64](https://ruby-doc.org/stdlib-2.5.3/libdoc/base64/rdoc/Base64.html#method-i-urlsafe_encode64)

the gsub is performed on the final tempStr instead of the hash only

Here is the modified version that works:

```auto
time = (Time.now.to_i * 1000 - 30000).to_s
data = Base64.urlsafe_encode64(options[:api_key] + options[:meeting_number] + time + options[:role].to_s)
hash = Base64.urlsafe_encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), options[:api_secret], data))
tempStr = options[:api_key] + '.' + options[:meeting_number] + '.' + time + '.' + options[:role].to_s + '.' + hash
replacedTmpStr = tempStr.gsub('-', '+').gsub('_', '/')
return Base64.urlsafe_encode64(replacedTmpStr).gsub(/#{Regexp.escape('=')}+$/, '')

```

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 10, 2020, 2:12am UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/15 "2020-08-10T02:12:09Z")

</div>

Hey @cnadeau,

Thanks for posting this and contributing to the Zoom Developer Community! 🙂

-Tommy

---

<div class="post-metadata">

**Author:** ![umesh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/umesh/32/7556_2.png) [@umesh](https://devforum.zoom.us/u/umesh)\
**Post date:** [October 6, 2020, 5:14am UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/16 "2020-10-06T05:14:14Z")

</div>

I am facing this same issue. “Meeting Timeout” randomly occurs. I have used Signature Generation Code in Java.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 6, 2020, 4:52pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/17 "2020-10-06T16:52:57Z")

</div>

Hey @umesh,

Which version of the Web SDK are you using? Can you please provide more details so we can help?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![umesh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/umesh/32/7556_2.png) [@umesh](https://devforum.zoom.us/u/umesh)\
**Post date:** [October 7, 2020, 3:37am UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/18 "2020-10-07T03:37:38Z")

</div>

We recently updated to v1.8.1.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 7, 2020, 9:56pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/19 "2020-10-07T21:56:30Z")

</div>

Hey @umesh,

Can you share your Java signature generation code so I can test on my end? Make sure it matches with our sample code:

> **[Generate Signature - Build an App - Web - Native SDKs - Zoom Software...](https://marketplace.zoom.us/docs/sdk/native-sdks/web/build/signature)**
>
> Generate Signature
> 
> Each request to start or join a meeting / webinar must be verified by an encrypted signature authorizing each user to enter. A signa...

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![umesh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/umesh/32/7556_2.png) [@umesh](https://devforum.zoom.us/u/umesh)\
**Post date:** [October 8, 2020, 4:49am UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/20 "2020-10-08T04:49:12Z")

</div>

Here. It is matches with sample.

```
 public String generateSignature(String meetingNumber, Integer role, String apiKey, String 
          apiSecret) {  
try {    
        Mac hasher = Mac.getInstance("HmacSHA256");
        String ts = Long.toString(System.currentTimeMillis() - 30000);
        String msg = String.format("%s%s%s%d", apiKey, meetingNumber, ts, role);
        hasher.init(new SecretKeySpec(apiSecret.getBytes(), "HmacSHA256"));

        String message = Base64.getEncoder().encodeToString(msg.getBytes());
        byte[] hash = hasher.doFinal(message.getBytes());

        String hashBase64Str = DatatypeConverter.printBase64Binary(hash);
        String tmpString =
                String.format("%s.%s.%s.%d.%s", apiKey, meetingNumber, ts, role, hashBase64Str);
        String encodedString = Base64.getEncoder().encodeToString(tmpString.getBytes());

        return encodedString.replaceAll("\\=+$", "");

    } catch (NoSuchAlgorithmException | InvalidKeyException e) {
        logger.error("Failed to generate signature", e);
    }
    
    return "";
}
```

---

<div class="post-metadata">

**Author:** ![bryancarvallo19](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/bryancarvallo19/32/16785_2.png) [@bryancarvallo19](https://devforum.zoom.us/u/bryancarvallo19)\
**Post date:** [October 9, 2020, 4:47pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/21 "2020-10-09T16:47:51Z")

</div>

Hello I am new in the community and I am presenting the same error in the example application with the sdk here I leave my signature if someone can help me please I am using php to generate the signature I detail code

$api\_key=’’;  
$api\_secret=’’;  
$meeting\_n=;  
$role=0;

echo $signa=generate\_signature ( $api\_key, $api\_secret, $meeting\_n, $role);

function generate\_signature ( $api\_key, $api\_secret, $meeting\_number, $role){

```
$time = time() * 1000 - 30000;//time in milliseconds (or close enough)

$data = base64_encode($api_key . $meeting_number . $time . $role);

$hash = hash_hmac('sha256', $data, $api_secret, true);

$_sig = $api_key . "." . $meeting_number . "." . $time . "." . $role . "." . base64_encode($hash);

//return signature, url safe base64 encoded
return rtrim(strtr(base64_encode($_sig), '+/', '-_'), '=');

```

}

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 12, 2020, 7:29pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/22 "2020-10-12T19:29:33Z")

</div>

Hey @bryancarvallo19,

You are using an SDK App Key and Secret to generate the Web SDK signature. You need to use a [JWT App](https://marketplace.zoom.us/docs/guides/build/jwt-app) instead.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [October 12, 2020, 7:31pm UTC](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866/23 "2020-10-12T19:31:50Z")

</div>

Hey @umesh,

Okay, that is the correct signature. What region are you located in? Are you seeing any errors in the browser console? Are you using the CDN or Local version?

Can you try using this sample app to see if it fixes the issue:

> **[zoom/websdk-sample-signature-node.js](https://github.com/zoom/websdk-sample-signature-node.js)**
>
> Genrerate a signature to Start and Join Meetings and Webinars with the Zoom Web SDK. - zoom/websdk-sample-signature-node.js

Thanks,  
Tommy

[Next page](https://devforum.zoom.us/t/web-sdk-random-joining-meeting-timeout-signature-is-invalid-error/24866.md?page=2)
