Invalid Signature with Sample Web App

Hey @tommy,

Will you help me with generating the signature in Ruby.

So far I have tried below code:

 ts = (Time.now.to_f * 1000).round(0) - 30000
  msg = Base64.strict_encode64(@api_key + @meeting_number + ts.to_s + @role)

  digest = OpenSSL::Digest::SHA256.new
  hmac = OpenSSL::HMAC.new(@api_secret, digest)
  hmac << msg
  hash = Base64.encode64(hmac.digest)

  signature = Base64.urlsafe_encode64("#{@api_key}.#{@meeting_number}.#{ts.to_s}.#{@role}.#{hash}")

Error: /**/localJsonpCallback({“status”:false,“errorCode”:200,“errorMessage”:“Invalid signature.”,“result”:null});

Hi @deepak2,

Can you make sure that your systems settings is up to date? Please see my comment on this post -
Join meeting timeout or signature expired.

I was able to solve this in Ruby.

1 Like

Hi @deepak2,

We’re glad that you were able to resolve the issue. We’ll update our Generate Signature docs to include a Ruby example - https://marketplace.zoom.us/docs/sdk/native-sdks/web/essential/signature

Let us know if you need anything else.

Thanks

I didn’t see any ruby examples here:

Do you have an example somewhere?

Hey @deepak2,

Can you share the Ruby code function you developed? We would be happy to add it to the docs. :slight_smile:

CC @anthony

Thanks,
Tommy

Yes. Sure.

Below is the code:

require "base64"
require "openssl"

module Zoom
  class SignatureGenerator
    def initialize(meeting_number)
      @meeting_number = meeting_number
      @api_key = "< api key >"
      @api_secret = "< api secret >"
      @role = "0"   # for attendee
    end

    def encode64s(value)
      Base64.strict_encode64(value)
    end

    def signature
      ts = (Time.now.to_f * 1000).round(0) - 30000
      msg = encode64s(@api_key + @meeting_number + ts.to_s + @role)

      hash = encode64s(OpenSSL::HMAC.digest("sha256", @api_secret, msg))
      encode64s("#{@api_key}.#{@meeting_number}.#{ts.to_s}.#{@role}.#{hash}")
    end
  end
end
3 Likes

Thanks @deepak2! :slight_smile:

@anthony, check out the ruby example! ^

-Tommy

hello deepak2

I also tried to generate signature in ruby on rails like this

def signature
logger.info params
timestamp = (Time.now.to_f * 1000).to_i - 30000
logger.info timestamp
message = Base64.strict_encode64("#{params[:apiKey]}#{params[:meetingNumber]}#{timestamp}#{params[:role]}")
hash = Base64.strict_encode64(OpenSSL::HMAC.digest(‘sha256’, params[:apiSecrete], message))
signature = Base64.strict_encode64("#{params[:apiKey]}.#{params[:meetingNumber]}.#{timestamp}.#{params[:role]}.#{hash}")


respond_to do |format|
  format.json { render json: {signature: signature} }
end
end

I think it’s same to your code
But it works with meetings created only one account.
If i use MeetingID created another account this Error shows
“Your connection has timed out and you cannot join the meeting. Verify your network connectivity and try again.”
please help me!

Hello @aokirihito,

I was earlier on Zoom Pro account and I cancelled my Pro account on May 26.
After that customers started facing the issue of “Your connection has timed out and you cannot join the meeting. Verify your network connectivity and try again”.

I purchased the Pro plan again on Jun 29 and this issue got solved. Please make sure your account (with which the JWT token is created in zoom marketplace) is at least on Pro account.

1 Like

Thank you for your attention
I’ll try it

Thanks again

Hey @aokirihito,

Did @deepak2’s suggestion fix the issue?

Thanks,
Tommy

Hello everyone,
I have been working for some time to integrate Zoom Web SDK in my application. The error I am currently experiencing is: << Signature is invalid. >> and the console displays:
{
“method”: “join”,
“status”: false,
“result”: “Invalid signature.”,
“errorMessage”: “Signature is invalid.”,
“errorCode”: 3712
}
For more information:

  • I’m using the JWT App Type Credentials for the API_KEY and API_SECRET;
  • I have created a meeting with number: 77630292569 and password: 1001;
  • The signature which is generated is: “YWJJdmstdnRRQVM4WlJsQUQwejB2US43NzYzMDI5MjU2OS4xNTk0MjE4Mzg1MDAwLjEuZXR6dlRFdDc1UWFqQ2l0MVdyU1NrZXVJMjUwQjczSHM3eVN2S0dCNGVpVT0”;

Hey @kiyser,

How are you generating your signature? From the looks of it, that meetingID has not been started.

Thanks,
Tommy

Hi,

I am trying to use the sample web app from github zoom/sample-app-web/tree/master/Local

1 - i replaced the API key and API secret
2 - i generated a JWT token using the API key and API secret on jwt.io and tested the token successfully on various Postman Zoom API calls
3 - i generated a signature using the github zoom/websdk-sample-signature-node.js app and an existing meetingid from my user account
4 - i generated that signature using an existing meeting id and tried for role 0 & 1

Unfortunately i’m getting an invalid signature error every time i try to test the sample app using the described steps above.

Can you please me help understand what am i doing wrong? Is it a timezone issue generating the signature? I’m currently testing and developing on a GMT+2 time zone and the Zoom meeting was created with a Los Angeles timezone.

Thank you.

Hey @rackermann,

Please share your Web SDK signature so I can debug it.

Thanks,
Tommy

1 Like

Hi @tommy,

This is the latest signature that i used for testing on an existing meeting with role 1:

Wlg1bmdIOFNRYk9JUVBobkJWQUlFZ0NvcHkuOTk1MDYwMDI0MjQuMTU5NjU2MDI3NDA1OS4xLmlROENuaS9ULzQrVm9XOEhKVlU4N0p4VHRRd09PMGxqYUoxbkh1Ykh1ZDA9

Thank you.

Hey @rackermann,

After base64 decoding your signature, you have the string copy at the end of your JWT Key. Please double check you are setting the correct API Key.

Thanks,
Tommy

Thank you, very much @tommy! Cheers!
The demo is working now. I’ve copied that key so many times in so many places and in the most important one i didn’t see the “copy” string. :frowning: :zipper_mouth_face:

1 Like

You are welcome! :slight_smile:

Happy to hear you got it working!

-Tommy