0

i need help to write the signature which i need to join a zoom meeting / webinar.

There is an example provided on github: https://github.com/zoom/meetingsdk-sample-signature-node.js

It is written in node.js

This is node.js example for SDK

const iat = Math.round(new Date().getTime() / 1000) - 30;
  const exp = iat + 60 * 60 * 2

  const oHeader = { alg: 'HS256', typ: 'JWT' }

  const oPayload = {
    sdkKey: process.env.ZOOM_SDK_KEY,
    mn: req.body.meetingNumber,
    role: req.body.role,
    iat: iat,
    exp: exp,
    appKey: process.env.ZOOM_SDK_KEY,
    tokenExp: iat + 60 * 60 * 2
  }

  const sHeader = JSON.stringify(oHeader)
  const sPayload = JSON.stringify(oPayload)
  const signature = KJUR.jws.JWS.sign('HS256', sHeader, sPayload, process.env.ZOOM_SDK_SECRET)

  res.json({
    signature: signature
  })

There is also an example from the docs for php: https://marketplace.zoom.us/docs/sdk/native-sdks/web/signature/

function generate_signature ( $api_key, $api_secret, $meeting_number, $role){
  //Set the timezone to UTC
  date_default_timezone_set("UTC");
    $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), '+/', '-_'), '=');
}

--> But this is for JWT App type and i need it for SDK App Type..

I use meetingsdk-sample-signature to generate an example signature ( https://github.com/zoom/meetingsdk-sample-signature-node.js)- this works for testing purposes but i need the signature written in php and all my efforts did not work to get the same signature provided in the sample app...

I want to apologize i am not familiar with php and i would appreciate any help / hints how to do this very much!

MeepMeep
  • 55
  • 1
  • 6

1 Answers1

0

ho risolto in questo modo ho scaricato questo progetto github https://github.com/gamegos/php-jws dopo di che ho installato le dipendenze con il comando composer install infine ho aggiunto i dati mancanti a partire dai dati che erano presenti nel progetto node.

https://github.com/vincenzo85/jwtphp qui trovi il file modificato