# JOIN\_MEETING\_FAILED when Role equals 1

**URL:** <https://devforum.zoom.us/t/join-meeting-failed-when-role-equals-1/107791>\
**Category:** Web\
**Created:** [April 12, 2024, 1:29pm UTC](https://devforum.zoom.us/t/join-meeting-failed-when-role-equals-1/107791 "2024-04-12T13:29:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpcarnell](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/rpcarnell/32/49083_2.png) [@rpcarnell](https://devforum.zoom.us/u/rpcarnell)\
**Post date:** [April 12, 2024, 1:29pm UTC](https://devforum.zoom.us/t/join-meeting-failed-when-role-equals-1/107791/1 "2024-04-12T13:29:28Z")

</div>

I have the following code in Javascript:

```
  function startMeet(meetingId) {
          const iat = Math.round((new Date().getTime() - 30000) / 1000);
          const exp = iat + 60 * 60 * 2;
          const oHeader = {alg: 'HS256', typ: 'JWT'};
          const oPayload = {
              sdkKey: '<?= $sdkkey ?>',
              mn: meetingId,
              role: 1,
              iat: iat,
              exp: exp,
              appKey: '<?= $sdkkey ?>',
              tokenExp: iat + 60 * 60 * 2
          };
  
          const sHeader = JSON.stringify(oHeader);
          const sPayload = JSON.stringify(oPayload);
          const sdkJWT = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, '<?= $sdkSecret ?>');
   
          const client = ZoomMtgEmbedded.createClient();
          let meetingSDKElement = document.getElementById('zmmtg-root');
          $.ajax(
                  {
                      method: "GET",
                      url: "/providers/getZoomDak",
                  }).done(function (msg)
          {
               msg = JSON.parse(msg);
              client.init({ enforceMultipleVideos: true, minimumParticipantsForGalleryView: 2, zoomAppRoot: meetingSDKElement, language: 'en-US', customize: {video: {disableDraggable: true, isResizable: false, viewSizes: {default: {width: 800, height: 500}, ribbon: {width: 300, height: 700}}}}});
              
              client.join({
                  sdkKey: '<?= $sdkkey ?>',
                  signature: sdkJWT, // role in SDK signature needs to be 1
                  meetingNumber: meetingId,
                  password: '23421321',
                  userName: "Don Carson Don",
                  zak: msg.zak // the host's zak token
              }).then(() => {
                  stream = client.getMediaStream()
                  client.getAllUser().forEach((user) => {
                      if (user.bVideoOn) {
                          stream.renderVideo(document.querySelector('#participants-canvas'), user.userId, 960, 540, X_CORD, Y_CORD, 2)
                      }
                  })
              });
              
              client.on('video_statistic_data_change', (payload) => {
                  $('.react-draggable').removeClass('react-draggable');
                  console.log('emit', payload);
              });
          });
      }

```

It works when role is 0, but I get JOIN\_MEETING\_FAILED when I switch to role equals 1. From the Network section of developer tools I get the following from the zoom server: FailedFromWeb, RESULT\_UNKOWN\_ERROR, 200

I thought it was the zak token, but that seems fine.

What is weird is that I get the popup saying Failed to join Meeting. When I click on retry, I get “Signature is Invalid”.

---

<div class="post-metadata">

**Author:** ![rpcarnell](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/rpcarnell/32/49083_2.png) [@rpcarnell](https://devforum.zoom.us/u/rpcarnell)\
**Post date:** [April 13, 2024, 11:24am UTC](https://devforum.zoom.us/t/join-meeting-failed-when-role-equals-1/107791/2 "2024-04-13T11:24:41Z")

</div>

Okay,

I was using the following:

```
    <script src="https://source.zoom.us/3.1.0/zoom-meeting-embedded-3.1.0.min.js">. 
    </script>

```

I changed it to this:

```
 <script src="https://source.zoom.us/2.15.0/zoom-meeting-embedded-2.15.0.min.js"></script>

```

The issue seems gone now.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [May 13, 2024, 9:25pm UTC](https://devforum.zoom.us/t/join-meeting-failed-when-role-equals-1/107791/3 "2024-05-13T21:25:21Z")

</div>

Closed on May 13, 2024, 9:25pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
