Ruby - signature is invalid. Error code: 3712

Hey,
I’m creating app which should create meeting via API, next users join to this meeting using only browser.
I’ve created app “Server-to-Server OAuth” in Zoom Market.
I have a working creating access token.
I have a working creating meeting using API with this access token.
And next I wanna start video using component-view like here https://github.com/zoom/meetingsdk-javascript-sample/blob/master/component-view.js
But I got error from SDK “signature is invalid. Error code: 3712”.
My code:
ruby - create signature

   iat = Time.now.to_i - 30
   exp = iat + 60 * 60 * 2
    header = {
      alg: 'HS256',    
      typ: 'JWT'        
    }
    payload = {
      sdkKey: client_id,
      appKey: client_id,
      mn: meeting_id,
      role: 0,
      iat: iat,
      exp: exp,
      tokenExp: exp
    }
    signature = JWT.encode(payload, client_secret, 'HS256', header)

Signature is like this:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJDODZjSllIclJmbXozNVo5UkhxR2tnIiwiYXBwS2V5IjoiQzg2Y0pZSHJSZm16MzVaOVJIcUdrZyIsIm1uIjo4NDE3MDMxMDc5Mywicm9sZSI6MCwiaWF0IjoxNjk1MjA0MzE5LCJleHAiOjE2OTUyMTE1MTksInRva2VuRXhwIjoxNjk1MjExNTE5fQ.B2DUipxAe_LNzm8CyfQstom5Qc7fP7QypsuCq38BjZQ

JS SDK:

      const client = ZoomMtgEmbedded.createClient()
      let meetingSDKElement = document.getElementById('video-call')
      var authEndpoint = ''
      var sdkKey = ''
      var meetingNumber = "MEETING_NUMBER";
      var passWord = '';
      var role = 1;
      var userName = 'JavaScript'
      var userEmail = ''
      var registrantToken = ''
      var zakToken = ''

      client.init({
        zoomAppRoot: meetingSDKElement,
        language: 'en-US',
      })

      client.join({
        role: 1,
        signature: "SIGNATURE",
        sdkKey: 'CLIENT_ID',
        meetingNumber: meetingNumber,
        password: passWord,
        userName: userName,
        userEmail: userEmail,
        tk: registrantToken,
        zak: zakToken
      })

MEETING_NUMBER, SIGNATURE, CLIENT_ID - these are variables from ruby. So values are correct.

Please help me. I’m stuck on with this.

“role” does not match - in the signature it says “role=0” (attendee), when joining it says “role=1” (host)

Thanks for the reply. I tried with role as 0 and 1. But I got the same error ;/

here are more infos for troubleshooting signature

if this not help, you should go a step back and try the the zoom SDK example (without backend)

embeded view (-> public/cdn.html)

client view (-> CND/index.html)

@j.schoenemeyer Hey! Thanks for the links.
I started checking all points from the troubleshooting zoom article.
And there is: “Make sure you’re using a Meeting SDK app type, not OAuth or server-to-server OAuth.”
I used only Server-to-Server OAuth".
So after changes I have:
Server-to-server credentials: create access token, create meeting via API.
Meeting SDK credentials: create signature and fire up component-view in JS.
Ah! I had to add a password for the meeting.
Now it seems to work :wink: Thanks!

1 Like