# Problem with JWT authorization using Zoom provided examples

**URL:** <https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670>\
**Category:** Video SDK\
**Created:** [October 12, 2023, 8:44am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670 "2023-10-12T08:44:14Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![abahno](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abahno](https://devforum.zoom.us/u/abahno)\
**Post date:** [October 12, 2023, 8:44am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/1 "2023-10-12T08:44:14Z")

</div>

Hello.  
I’m following tutorial " Create a Video SDK app".  
I generated JWT using the example videosdk-auth-endpoint-sample .  
I’m getting a signature like that:  
curl -L -X POST ‘[http://localhost:4000](http://localhost:4000)’ \

> ```
> -H 'Content-Type: application/json' \
> -d '{ "sessionName": "testSession1", "role": 1,"sessionKey": "session123", "userIdentity": "user1"}'
> 
> ```

{“signature”:“xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx…xxxxxxxxxxxxxxxxxxx”}

And then trying to authorize.  
curl \

> –request GET   
> –header “Authorization: Bearer xxxxxxxxxxxxxxxxx”   
> –header “Accept: application/json”   
> –url “[https://api.zoom.us/v2/videosdk/sessions](https://api.zoom.us/v2/videosdk/sessions)”

And always get a response:  
{“code”:124,“message”:“Invalid access token.”}  
Also, I used this signature directly for Linux SDK initialization, and it looks the same as it didn’t work. I.e. after SDK initialization it receives - 0 users, and ZoomVideoSDKDelegate is always silent.

Also, I see that in all tutorials SDK key and secret is used, but in market place I have also API key and secret. Could you please explain In which cases API key\secret is used?  
Would appreciate for any help.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [October 13, 2023, 12:52am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/2 "2023-10-13T00:52:58Z")

</div>

@abahno ,

For SDK Key and SDK Secret, this pair is used only for SDK Authentication.  
For API Key and API Secret, this pair is used only for API Access, such as [https://api.zoom.us/v2/videosdk/sessions](https://api.zoom.us/v2/videosdk/sessions)

---

<div class="post-metadata">

**Author:** ![abahno](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abahno](https://devforum.zoom.us/u/abahno)\
**Post date:** [October 17, 2023, 3:40pm UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/3 "2023-10-17T15:40:58Z")

</div>

@chunsiong.zoom Thank you for the explanation.

I managed to run videosdk-web-sample from Zoom repo, but I can’t make Linux SDK work. The received session is always “empty” - no user, no session name …  
My output is:

Video SDK version: 1.8.10 (6932)  
initializing SDK error code: 0  
in session: 0, sessionID: , sessionNumber: 0, sessionPass: , sessionName: , sessionHostName:  
number of users 0

I’m using the code below. Here I copy past the token that was generated with web-sample(I use it since I know that it works for sure).

The other problem with log absence, I put enableLog = true but SDK produces no log files.  
Here is my code:

```auto
IZoomVideoSDK* sdk = CreateZoomVideoSDKObj();
assert(sdk != nullptr);
std::cout << "Video SDK version: " << sdk->getSDKVersion() << std::endl;

ZoomVideoSDKInitParams iniParams;
iniParams.domain = "https://go.zoom.us"; //"https://zoom.us";
iniParams.enableLog = true;
iniParams.logFilePrefix = "logPrefix";
iniParams.enableIndirectRawdata = false;
iniParams.audioRawDataMemoryMode = ZoomVideoSDKRawDataMemoryModeStack;
iniParams.videoRawDataMemoryMode = ZoomVideoSDKRawDataMemoryModeStack;

ZoomVideoSDKErrors iniError = sdk->initialize(iniParams);
std::cout << "initializing SDK error code: " << iniError << std::endl;
assert(iniError == ZoomVideoSDKErrors_Success);   

CSDKListener listener(sdk);
sdk->addListener(&listener);

ZoomVideoSDKSessionContext sessionContext;

sessionContext.token = {{generated token with the same topic and user name from web-sample}};
sessionContext.userName = "name1";
sessionContext.sessionName = "topic"; 

IZoomVideoSDKSession* session = sdk->joinSession(sessionContext);
assert(session != nullptr);

std::string sessionId = session->getSessionID() != NULL ? session->getSessionID() : "";
int sessionNumber = session->getSessionNumber();
std::string sessionName = session->getSessionName() != NULL ? session->getSessionName() : "";
std::string sessionHostName = session->getSessionPassword() != NULL ? session->getSessionPassword() : "";
std::string sessionPassword = session->getSessionName() != NULL ? session->getSessionName() : "";

std::cout << "in session: " << sdk->isInSession()
		  << ", sessionID: " << sessionId 
		  << ", sessionNumber: " << sessionNumber
		  << ", sessionPass: " << sessionPassword
		  << ", sessionName: " << sessionName
		  << ", sessionHostName: " << sessionHostName
		  << std::endl;

IVideoSDKVector<IZoomVideoSDKUser*>* users = session->getRemoteUsers();
assert(users != nullptr);
std::cout << "number of users " << users->GetCount() << std::endl;
return 0;

```

Would appreciate for any help.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [October 18, 2023, 3:11am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/4 "2023-10-18T03:11:58Z")

</div>

@abahno , is the sessionName “topic”?

---

<div class="post-metadata">

**Author:** ![abahno](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abahno](https://devforum.zoom.us/u/abahno)\
**Post date:** [October 18, 2023, 7:05am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/5 "2023-10-18T07:05:03Z")

</div>

yes, the sessionName is topic.

---

<div class="post-metadata">

**Author:** ![abahno](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abahno](https://devforum.zoom.us/u/abahno)\
**Post date:** [October 19, 2023, 5:24pm UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/6 "2023-10-19T17:24:33Z")

</div>

Unfortunately, I still have this issue with Linux SDK.  
@chunsiong.zoom If any additional information is required, please ping me.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [October 20, 2023, 2:55am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/7 "2023-10-20T02:55:42Z")

</div>

@abahno , so the issue you have is that Linux Video SDK cannot connect to your Video SDK for Web session?

> -H ‘Content-Type: application/json’   
> -d ‘{ “sessionName”: “testSession1”, “role”: 1,“sessionKey”: “session123”, “userIdentity”: “user1”}’

I see that you have sessionKey entered in your Web SDK. Could you try remove that and making sure it is empty, so that both SDK have similar parameters when joining/starting a VideoSession?

---

<div class="post-metadata">

**Author:** ![abahno](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abahno](https://devforum.zoom.us/u/abahno)\
**Post date:** [November 7, 2023, 5:05pm UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/8 "2023-11-07T17:05:21Z")

</div>

@chunsiong.zoom I apologize for the late response, I switched to Windows SDK for some time.  
I guess the problem is that I’m trying to run a console application, and as mentioned here [joinSession Event callbacks are not fired](https://devforum.zoom.us/t/joinsession-event-callbacks-are-not-fired/43426) for Windows it’s required to run a message loop. I guess Linux SDK needs something similar. Could you please provide more details on how the event loop for SDK functions? I see that Linux SDK goes with a bunch of QT libs, I have to use qt\_event\_loop or something else from QT?  
PS: I’m testing the same code for Zoom SDK on Windows and Linux. On Windows all works fine.

Update: I see similar problem in another post - [Unable to join session with Zoom Video SDK for Linux](https://devforum.zoom.us/t/unable-to-join-session-with-zoom-video-sdk-for-linux/85375)  
Looks like problem with Linux SDK.

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [November 8, 2023, 6:25am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/9 "2023-11-08T06:25:47Z")

</div>

@abahno I’m working on publishing the sample for Linux Video SDK

My main method does something like this

```auto
GMainLoop* loop;
.
.
.
.
.

gboolean timeout_callback(gpointer data)
{
	return TRUE;
}

void my_handler(int s)
{
	printf("\nCaught signal %d\n", s);
	video_sdk_obj->leaveSession(false);
	printf("Leaving session.\n");
}

int main(int argc, char* argv[])
{
.
.
.
.
.
.

	printf("begin to join: %s\n", self_dir.c_str());
	joinVideoSDKSession(session_name, session_psw, session_token);

	struct sigaction sigIntHandler;

	sigIntHandler.sa_handler = my_handler;
	sigemptyset(&sigIntHandler.sa_mask);
	sigIntHandler.sa_flags = 0;

	sigaction(SIGINT, &sigIntHandler, NULL);

	loop = g_main_loop_new(NULL, FALSE);

	// add source to default context
	g_timeout_add(100, timeout_callback, loop);
	g_main_loop_run(loop);
	return 0;
}

```

---

<div class="post-metadata">

**Author:** ![abahno](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@abahno](https://devforum.zoom.us/u/abahno)\
**Post date:** [November 8, 2023, 4:06pm UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/10 "2023-11-08T16:06:33Z")

</div>

@chunsiong Linux Sample will be really helpful. Thank you!

---

<div class="post-metadata">

**Author:** ![chunsiong.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chunsiong.zoom/32/35488_2.png) [@chunsiong.zoom](https://devforum.zoom.us/u/chunsiong.zoom)\
**Post date:** [November 9, 2023, 12:33am UTC](https://devforum.zoom.us/t/problem-with-jwt-authorization-using-zoom-provided-examples/96670/11 "2023-11-09T00:33:07Z")

</div>

Closed on November 9, 2023, 12:33am UTC


