# Zoom meeting sample javascript giving error

**URL:** <https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473>\
**Category:** Web\
**Created:** [June 1, 2023, 2:23pm UTC](https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473 "2023-06-01T14:23:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoomema2020](https://avatars.discourse-cdn.com/v4/letter/z/35a633/32.png) [@zoomema2020](https://devforum.zoom.us/u/zoomema2020)\
**Post date:** [June 1, 2023, 2:23pm UTC](https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473/1 "2023-06-01T14:23:18Z")

</div>

API ENDPOINT  
_[GitHub - zoom/meetingsdk-javascript-sample: Use the Zoom Meeting SDK in (vanilla) JavaScript](https://github.com/zoom/meetingsdk-sample-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,

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [June 1, 2023, 8:28pm UTC](https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473/2 "2023-06-01T20:28:10Z")

</div>

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)

> **[GitHub - zoom/meetingsdk-web-sample: Zoom Meeting SDK web sample](https://github.com/zoom/meetingsdk-web-sample)**
>
> Zoom Meeting SDK web sample. Contribute to zoom/meetingsdk-web-sample development by creating an account on GitHub.

the CDN version is ready to use within few simple steps

```auto
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 './'

```

---

<div class="post-metadata">

**Author:** ![zoomema2020](https://avatars.discourse-cdn.com/v4/letter/z/35a633/32.png) [@zoomema2020](https://devforum.zoom.us/u/zoomema2020)\
**Post date:** [June 2, 2023, 4:31am UTC](https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473/3 "2023-06-02T04:31:14Z")

</div>

@ [j.schoenemeyer](https://devforum.zoom.us/u/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?

---

<div class="post-metadata">

**Author:** ![j.schoenemeyer](https://avatars.discourse-cdn.com/v4/letter/j/f9ae1b/32.png) [@j.schoenemeyer](https://devforum.zoom.us/u/j.schoenemeyer)\
**Post date:** [June 2, 2023, 4:44am UTC](https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473/4 "2023-06-02T04:44:20Z")

</div>

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

> [@Client SDK Invalid Signature errorCode:200 PHP](https://devforum.zoom.us/t/client-sdk-invalid-signature-errorcode-200-php/85056):
>
> Hello Everybody Description I need to update a JWT app to SDK meetings app before deprecation. I did create a new SDK app from Marketplace and I got a new Client Id and Client secret to use. Following the instructions on: [https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-app-migration/](https://marketplace.zoom.us/docs/guides/build/jwt-app/jwt-app-migration/) I replaced api key and secret with the new Client id and Client secret and updated signature generation with the new keys. I tested the new credentials with the sample app zoom-sdk-web-2.10.1, whic…

---

<div class="post-metadata">

**Author:** ![zoomema2020](https://avatars.discourse-cdn.com/v4/letter/z/35a633/32.png) [@zoomema2020](https://devforum.zoom.us/u/zoomema2020)\
**Post date:** [June 2, 2023, 2:23pm UTC](https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473/5 "2023-06-02T14:23:35Z")

</div>

@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

```auto
$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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [July 3, 2023, 12:24am UTC](https://devforum.zoom.us/t/zoom-meeting-sample-javascript-giving-error/89473/6 "2023-07-03T00:24:13Z")

</div>

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