Zoom meeting sample javascript giving error

API ENDPOINT
GitHub - zoom/meetingsdk-javascript-sample: Use the Zoom Meeting SDK in (vanilla) JavaScript

DESCRIPTION
I want to make use of meeting sdk at [[GitHub - zoom_meetingsdk-javascript-sample Use the Zoom Meeting SDK in (vanilla) JavaScript]] for my
zoom web meetings but I have not been able to obtain the json

return response.json()

in the client-view.js. it is giving me the error message ’

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data’lock

which from further investigation I discovered that the response was empty. I have provided the appropriate accurate meeting number as
available in zoom and used both 1 and 0 for role but the result is the same

Please how do I get it to run effectively. I am still running it inside my local system with localhost
here is my part of the code which I modified in the client-view

var authEndpoint = ''
var sdkKey = 'my client id'
var meetingNumber = 'meeting number on zoom'
var passWord = 'password on zoom'
var role = 0
var userName = 'any user name'
var userEmail = 'mymail@email.com'
var registrantToken = ''
var zakToken = ''
var leaveUrl = 'http://localhost:800'

I am using php

Cc @elisa.zoom, @donte.zoom,

do you have a server backend (-> authEndpoint) to create the signature?

if not - you should try first the other example (CDN version - pure JS without backend)

the CDN version is ready to use within few simple steps

CDN/js/index.js:20 var CLIENT_ID = "YOUR_CLIENT_ID_OR_SDK_KEY";
CDN/js/index.js:26 var CLIENT_SECRET = "YOUR_CLIENT_SECRET_OR_SDK_SECRET;
CDN/js/index.js:112 ... "/meeting.html?";  // replace '/' with './'

@ j.schoenemeyer Thank you very much for the reply.
But what can I do to get authEndPoint signature in my php backend.
What should I do, how can I create it?

have a look - at the end is a working php function for creating the signature

@j.schoenemeyer Thanks for the response. I was able to get it to produce signature but it is now giving an error

Object { method: “join”, status: false, result: “Invalid signature.”, errorMessage: “Signature is invalid.”, errorCode: 3712 }

the php code I used to produce the signature is

$header = array(
			'alg' => 'HS256', //alg is required
			'typ' => 'JWT'
		);
		date_default_timezone_set("UTC");
		$time = time() - 30;
		$exp = $time + 3600 * 2;

		$sdk_key = env('ZOOM_CLIENT_ID'); // your sdk
		$sdk_secret = env('ZOOM_CLIENT_SECRET'); // your secret
		$payload = array(
			'sdkKey' => $sdk_key,
			'mn' => $meeting_id, // meeting number 
			'role' => 0,
			'iat' => $time,
			'exp' => $exp,
			'appKey' => $sdk_key,
			'tokenExp' => $exp,
		);

		$key = $sdk_secret;

		$jws = new \Gamegos\JWS\JWS();

		// ENCODE
		$jwsStr = $jws->encode($header, $payload, $key);
		
		$data = array ( 'signature' => $jwsStr ); 

And i put the signature i.e. $data.signature where signature is required alongside all the other fields in the javasript file and it produced the error stated earlier.

Please how can i solve this problem

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