No sdk credentials created

Thanks Chun.
I’ve been able to do the set-up . I have to download another SDK files from zoom market place.
The only issue I’m having now is that I get an error “Joining meeting timeout signature is invalid” whenever I join or start a meeting. However after some retry the meeting will start.
Can you help with this.

Im using ZoomSDK not JWT

@omotehinsedelecaleb,

On your Zoom SDK App, you should be able to see Client ID and Client Secret.
You will need to use Client ID and Client Secret to create a JWT Token.

JWT Token is not the same as JWT App. It is easy to be confused.

To generate the JWT Token, you will need to do something like this. If you are using PHP, you will need to convert it to PHP and PHP specific libraries

const KJUR = require('jsrsasign')
// https://www.npmjs.com/package/jsrsasign

function generateSignature(key, secret, meetingNumber, role) {

  const iat = Math.round((new Date().getTime() - 30000) / 1000)
  const exp = iat + 60 * 60 * 2
  const oHeader = { alg: 'HS256', typ: 'JWT' }

  const oPayload = {
    sdkKey: key,
    mn: meetingNumber,
    role: role,
    iat: iat,
    exp: exp,
    appKey: key,
    tokenExp: iat + 60 * 60 * 2
  }

  const sHeader = JSON.stringify(oHeader)
  const sPayload = JSON.stringify(oPayload)
  const sdkJWT = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, secret)
  return sdkJWT
}

// For apps with SDK and OAuth credentials, pass in the SDK key and secret. For apps with only app credentials, pass in the client ID and secret.
console.log(generateSignature(process.env.SDK_KEY_OR_CLIENTID, process.env.SDK_OR_CLIENT_SECRET, 123456789, 0))

The JWT Token should look something like this

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzZGtLZXkiOiJhYmMxMjMiLCJtbiI6IjEyMzQ1Njc4OSIsInJvbGUiOjAsImlhdCI6MTY0NjkzNzU1MywiZXhwIjoxNjQ2OTQ0NzUzLCJhcHBLZXkiOiJhYmMxMjMiLCJ0b2tlbkV4cCI6MTY0Njk0NDc1M30.UcWxbWY-y22wFarBBc9i3lGQuZAsuUpl8GRR8wUah2M

Dear Chun,
I can’t thank you enough for the support you have been rendering for me on this issue. I get your explanation as regards the difference between the jwt token and the jwt app. i think sharing my code with you will give you a clearer view of what might be wrong.
I am using the sdk files that i downloaded directly from zoommarket place. Im using the sdk in CDN folder of the root directory
Screenshot 2023-02-22 105223.png
In the index.js file i have a code for generating signature similar to what you sent me

var signature = ZoomMtg.generateSDKSignature({
meetingNumber: meetingConfig.mn,
sdkKey: SDK_KEY,
sdkSecret: SDK_SECRET,
role: meetingConfig.role,
success: function (res) {
console.log(res.result);
meetingConfig.signature = res.result;
meetingConfig.sdkKey = SDK_KEY;
var joinUrl =
testTool.getCurrentDomain() +
"C:/Users/CGX/Downloads/zoom-sdk-web-2.9.7/CDN/meeting.html?" +
testTool.serialize(meetingConfig);
document.getElementById('copy_link_value').setAttribute('link', joinUrl);
copyToClipboard('copy_link_value');

},
});

The token generated looks like what you shared too. I will be delighted if you can spare some times to look into this as you have always does.
Thanks and best regards.

Hi Chun,
If you don’t mind you can share with me the code that worked for you. I’m using PHP and JavaScript

Screenshot 2023-02-22 105223.png

I can then troubleshoot my code with a working code

Screenshot 2023-02-22 105223.png

hi @omotehinsedelecaleb

do check out the code my colleague has created here

I’m pasting it here for easy reference

use \Firebase\JWT\JWT;

/**
 * Below are the fields required for the JWT payload
 * appKey: Your SDK Key. Required for Native, optional for Web.
 * sdkKey: Your SDK Key. Required for Web, optional for Native.
 * sdkSecret Required, your SDK API Secret
 * mn: The Zoom Meeting or Webinar Number. Required for Web, optional for Native.
 * role: The user role. Required for Web, optional for Native. Values: 0 to specify participant, 1 to specify host.
 * iat: The current timestamp in epoch format. Required.
 * exp: JWT expiration date. Required. Values: Min = 1800 seconds greater than iat value, max = 48 hours greater than iat value. In epoch format.
 * tokenExp: JWT expiration date. Required. Values: Min = 1800 seconds greater than iat value, max = 48 hours greater than iat value. In epoch format.
 * 
 * Source: https://marketplace.zoom.us/docs/sdk/native-sdks/auth/
 */
function generateSignature($clientID, $clientSecret, $meetingNumber, $role) {
    $iat = time();
    $exp = $iat + 60 * 60 * 2;
    $token_payload = [
        'appKey' => $clientID,
        'sdkKey' => $clientID,
        'mn' => $meetingNumber,
        'role' => $role,
        'iat' => $iat,
        'exp' => $exp,
        'tokenExp' => $exp
    ];

    $jwt = JWT::encode($token_payload, $clientSecret, 'HS256');
    
    return $jwt;
}
1 Like