# Meeting SDK v2.18.2 "Token Error" on instant start

**URL:** <https://devforum.zoom.us/t/meeting-sdk-v2-18-2-token-error-on-instant-start/99896>\
**Category:** Web\
**Tags:** video-sdk\
**Created:** [December 11, 2023, 2:20am UTC](https://devforum.zoom.us/t/meeting-sdk-v2-18-2-token-error-on-instant-start/99896 "2023-12-11T02:20:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ventura](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@ventura](https://devforum.zoom.us/u/ventura)\
**Post date:** [December 11, 2023, 2:20am UTC](https://devforum.zoom.us/t/meeting-sdk-v2-18-2-token-error-on-instant-start/99896/1 "2023-12-11T02:20:22Z")

</div>

I’ve checked all posts here relating to this and couldn’t find an answer that solved it for me.

So I have a server to server oath app and then the frontend with the web SDK. I generate the ZAK and Access Token on the server as such (as owner if role = 1):

```auto
const accessTokenReq = await fetch(
			`https://zoom.us/oauth/token?grant_type=account_credentials&account_id=${ZOOM_OAUTH_ACC_ID}`,
			{
				method: "POST",
				headers: { Authorization: `Basic ${ZOOM_OATH_BASIC_AUTH}` },
			}
		);

		const { access_token } = await accessTokenReq.json();

		const zakReq = await fetch(
			`https://api.zoom.us/v2/users/me/token?type=zak`,
			{
				method: "GET",
				headers: {
					Authorization: `Bearer ${access_token}`,
				},
			}
		);

		const { token } = await zakReq.json();

```

I then gen the signature as such:

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

		const oHeader = { alg: "HS256", typ: "JWT" };

		const oPayload = {
			sdkKey: ZOOM_CLIENT_ID,
			mn: meetingNumber,
			role: role,
			iat: iat,
			exp: exp,
			appKey: ZOOM_CLIENT_ID,
			tokenExp: iat + 60 * 60 * 3,
		};

		const sHeader = JSON.stringify(oHeader);
		const sPayload = JSON.stringify(oPayload);
		const signature = KJUR.jws.JWS.sign(
			"HS256",
			sHeader,
			sPayload,
			ZOOM_CLIENT_SECRET
		);

```

**NOTE:** `ZOOM_CLIENT_SECRET` and `ZOOM_CLIENT_ID` are for the meeting sdk app type and ZOOM\_OAUTH\_ACC\_ID and ZOOM\_OATH\_BASIC\_AUTH are for the server to server oauth app type.

I then return them to the client annd start/join the meeting like:

```auto
const initMeeting = async () => {
		ZoomMtg.setZoomJSLib("https://source.zoom.us/2.18.2/lib", "/av");

		ZoomMtg.preLoadWasm();
		ZoomMtg.prepareWebSDK();
		ZoomMtg.i18n.load("en-US");
		ZoomMtg.i18n.reload("en-US");

		const zoomAuth = await getSignature();

		if (!zoomAuth) {
			router.refresh();
			return;
		}

		const { key, signature, zak } = zoomAuth;

		const el = document.getElementById("zmmtg-root");

		el ? (el.style.display = "block") : null;

		ZoomMtg.init({
			leaveUrl: "https://demo.venturasolutions.org/thanks",
			success: (success: any) => {
				console.log("success\n", success);

				ZoomMtg.join({
					signature: signature,
					sdkKey: key,
					meetingNumber: toNumeric(),
					passWord: "",
					userName: cookie.name,
					userEmail: "",
					tk: "",
					zak: cookie.admin ? zak : undefined,
					success: (success: any) => {
						console.log("success 2\n", success);
					},
					error: (error: any) => {
						console.log("error 2\n", error);
					},
				});
			},
			error: (error: any) => {
				console.log("error\n", error);
			},
		});
	};

```

I’m getting the following errors:

```auto
{type: 'VIDEO', evt: 'ERROR', errorCode: 'NOT_CONNECTED', data: undefined}

```

and:

```auto
{method: 'join', status: false, result: 'Not support start meeting via tokens', errorMessage: 'Token error', errorCode: 3265}

```

I am using nextjs v13.4.8 and idk what the issue is, can I get some help? The server calls are done on the client so there’s no build time caching from ssr

---

<div class="post-metadata">

**Author:** ![JackYang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jackyang/32/1135_2.png) [@JackYang](https://devforum.zoom.us/u/JackYang)\
**Post date:** [December 11, 2023, 7:15pm UTC](https://devforum.zoom.us/t/meeting-sdk-v2-18-2-token-error-on-instant-start/99896/2 "2023-12-11T19:15:43Z")

</div>

@ventura can you try to change the role=0 test again

---

<div class="post-metadata">

**Author:** ![ventura](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@ventura](https://devforum.zoom.us/u/ventura)\
**Post date:** [December 11, 2023, 9:42pm UTC](https://devforum.zoom.us/t/meeting-sdk-v2-18-2-token-error-on-instant-start/99896/3 "2023-12-11T21:42:06Z")

</div>

@JackYang

The error I get for this:

“Joining meeting timeout. The meeting number is not found.”

My goal was to let the admin generate a meeting and immediately start it and my web app will handle the sharing of the link and all that; Ideally this ought to be done without zoom redirects. The [docs](https://developers.zoom.us/docs/api/rest/reference/zoom-api/methods/#operation/userZak) state that I should use the following url: `/users/me/zak` however this one requires a scope of `user_zak:read` which isn’t available for server to server oauth which gives me an account ID which is required to make an access token which is required to get the ZAK. So I keep getting denied because of no valid scopes for the url in the docs.

The scope is available for the normal oauth app (user managed) however it does not provide an account ID so I can’t generate an access token. I did try mixing my server oauth account ID and my normal oauth client ID and secret however that didn’t work out.

It kind of feels like a cache22 and the docs are pretty mysterious about the right way to do this and unfortunately the JWT zak has been deprecated of which all community posts here only reference its use.

Edit: Added ‘@’

---

<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:** [January 11, 2024, 7:43am UTC](https://devforum.zoom.us/t/meeting-sdk-v2-18-2-token-error-on-instant-start/99896/4 "2024-01-11T07:43:02Z")

</div>

Closed on January 11, 2024, 7:43am UTC

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