# ZoomController sdk\_authenticate getting exception

**URL:** <https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171>\
**Category:** Windows\
**Created:** [April 4, 2024, 10:10am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171 "2024-04-04T10:10:41Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 4, 2024, 10:10am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/1 "2024-04-04T10:10:41Z")

</div>

I am trying to authenticate using my zoom sdk key and secret but in onAuthenticationReturn callback i am getting authResult error code as 9 ( network issue). I am using zoom sdk version v5.14.5.15340. I am executing code using visual studio 19.

Code snippet:

void ZoomController::sdk\_authenticate() {  
AuthParam authParam;  
authParam.appKey = Utility::StringToWString(this-\>sdkKey);  
authParam.appSecret = Utility::StringToWString(this-\>sdkSecret);  
LOG\_INFO(TAG)\<\<“Authenticating Zoom SDK”\<\<endl;  
throwIfNotSuccess(authService-\>SDKAuth(authParam), **LINE** );  
Timers::set\_timer(TimerType::AuthenticationTimer, SDK\_CALL\_TIMEOUT);  
}

Device: Running windows 11 pro on vmware virtual machine.  
Host machine: macOs12.6. Chipset: M1pro  
Note: This is working fine on my colleague’s machine.

What are the possible reasons for getting network issues error ?

---

<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:** [April 5, 2024, 12:20am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/2 "2024-04-05T00:20:42Z")

</div>

@cai.zoom

5.14.5 has been deprecated on Feb 3rd 2024. This version no longer works

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 5, 2024, 6:45am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/3 "2024-04-05T06:45:09Z")

</div>

According to [Meeting SDK - Minimum version policy](https://developers.zoom.us/docs/meeting-sdk/minimum-version/), this version will be deprecated on May4. I am trying to move to latest zoom version but before that wanted to test the current version on my windows 11 vm. This auth is not working on windows 11 (seems to work in windows 10).

---

<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:** [April 5, 2024, 6:48am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/4 "2024-04-05T06:48:56Z")

</div>

@cai.zoom you are right on the version.

Anyway starting from 5.14.10, the appKey and appSecret has been removed.

You will need to sign your own JWT token using the appKey and appSecret instead of passing them directly into the parameters.

I’m using Windows 11, and this should not be an issue.

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 5, 2024, 9:41am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/5 "2024-04-05T09:41:23Z")

</div>

@chunsiong.zoom I upgraded my zoom sdk to latest version. For forming my JWT I followed the instructions given here:

> [@"auth sdk failed" when running zoom sdk demo](https://devforum.zoom.us/t/auth-sdk-failed-when-running-zoom-sdk-demo/37448/6):
>
> Hi. No matter what I tried on [http://jwt.io/](http://jwt.io/) - it always fail with “Auth SDK failed”. can you please provide a step by step instructions on how to generate the correct token? thanks

Used the jwt in this code snippet →   
AuthContext authContext;  
authContext.jwt\_token = “XXX”;  
LOG\_INFO(TAG)\<\<“Authenticating Zoom SDK”\<\<endl;  
throwIfNotSuccess(authService-\>SDKAuth(authContext), **LINE** );

But in onAuthenticationReturn callback I am getting authResult as 5 (Unknown error). What can be possible reasons for this error ?

---

<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:** [April 5, 2024, 10:12am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/6 "2024-04-05T10:12:52Z")

</div>

do you have a sample of the generated JWT token?

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 5, 2024, 10:23am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/7 "2024-04-05T10:23:20Z")

</div>

Yes @chunsiong.zoom . Sample JWT token:  
“eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcHBLZXkiOiIxaVhVZkxZR05oMHFSNmFSc0NqeVFneTN2WWxEVFMwVUxpa0oiLCJpYXQiOjE3MTIzMTIzNTksImV4cCI6MTcxMjM1NzQwNSwidG9rZW5FeHAiOjE3MTIzNTc0MDV9.whobCMMPLuy6LReO3EBGfFGj0E0LzpBlaHfQaJgP9qM”

Valid for 12.5 hours  
Note: I used the same token for zoom sdk demo app authentication and its working perfectly there.

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 8, 2024, 6:41am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/8 "2024-04-08T06:41:01Z")

</div>

@chunsiong.zoom Should i create a new topic for this discussion or should we continue in this thread ?

---

<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:** [April 8, 2024, 8:35am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/9 "2024-04-08T08:35:00Z")

</div>

@cai.zoom since the JWT token works for the sample app, we can deduce that it is not a token issue. It might make more sense to try to capture a log while replicating this issue.

Are you able to capture the log based on this guide?

> **[Procedure to collect logs from Zoom Meeting SDK apps](https://developers.zoom.us/blog/msdk-log-retrieval-instructions/)**
>
> This article explains the procedure to collect SDK logs from any platform

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 8, 2024, 10:12am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/10 "2024-04-08T10:12:18Z")

</div>

Yes @chunsiong.zoom I can capture logs, although they are not in human readable format. Attaching log file of my latest run down below:

> **[ZoomIntegration.exe\_3.log](https://drive.google.com/file/d/1DQFyLHb8bAEyP9p7eFmV29ZB6XsAJHpJ/view?usp=sharing)**
>
> Google Drive file.

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 9, 2024, 5:57am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/11 "2024-04-09T05:57:54Z")

</div>

@chunsiong.zoom Any findings from the logs ?

---

<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:** [April 9, 2024, 6:16am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/12 "2024-04-09T06:16:06Z")

</div>

@cai.zoom , I’ve PM you some findings earlier. wanted to check if you are using proxy server or specific firewall in your environment? There might be some odd URL rewrite done for outgoing traffic

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 9, 2024, 1:03pm UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/13 "2024-04-09T13:03:06Z")

</div>

@chunsiong.zoom I have tested this code in windows server 2016 using microsoft remote desktop and in windows 11 using vmware virtual machine. In both these machine I got the result error. I am not using any specific firewall in my environment. I tried authenticating with turning off all my firewalls but still got the same error.  
Please let me know the how can i debug this further

---

<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:** [April 9, 2024, 1:23pm UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/14 "2024-04-09T13:23:00Z")

</div>

Are you able to capture another log? @cai.zoom  
Will be good if you can provide for both

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 9, 2024, 6:52pm UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/15 "2024-04-09T18:52:06Z")

</div>

Yes sure @chunsiong.zoom . The log I gave above was for windows 11.

The log for windows server 2016:  
[ZoomIntegration.exe\_1.log - Google Drive](https://drive.google.com/file/d/1sAXMRo7qHCBA_QkLdEhnApyfordbqhWP/view?usp=drive_link).

@chunsiong.zoom Does the demo zoom sdk have a different jwt authentication mechanism ?

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 9, 2024, 7:18pm UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/16 "2024-04-09T19:18:05Z")

</div>

Sharing code snippet of **jwt creation** and **onAuthenticationReturn**

**JWT creation**

```auto
void ZoomController::sdk_authenticate() {
	Config config;
	AuthContext authContext;
	auto appKey = this->sdkKey;
	auto appSecret = this->sdkSecret;

	auto currentTime = std::chrono::system_clock::now();
	auto timeSinceEpoch = std::chrono::system_clock::to_time_t(currentTime);

	Json::Value header;
	header["alg"] = "HS256";
	header["typ"] = "JWT";

	Json::Value payload;
    payload["appKey"] = appKey;
    payload["iat"] = static_cast<Json::Int64>(timeSinceEpoch);
    payload["exp"] = static_cast<Json::Int64>(timeSinceEpoch + config.JWT_EXPIRY_TIME);
    payload["tokenExp"] = static_cast<Json::Int64>(timeSinceEpoch + config.JWT_EXPIRY_TIME);

	// Convert Json::Value to string
    Json::StreamWriterBuilder builder;
    builder["commentStyle"] = "None";
    builder["indentation"] = ""; // Compact JSON representation
    std::string strHeader = Json::writeString(builder, header);
    std::string strPayload = Json::writeString(builder, payload);

	// Base64 encode the header and payload using cppcodec
	std::string encodedHeader = cppcodec::base64_url_unpadded::encode(strHeader);
	std::string encodedPayload = cppcodec::base64_url_unpadded::encode(strPayload);

	std::string signingInput = encodedHeader + "." + encodedPayload;
	std::string hexSignature = hmac<SHA256>(signingInput, appSecret);
	std::vector<uint8_t> binarySignature = hexToBinary(hexSignature);
	std::string encodedSignature = cppcodec::base64_url_unpadded::encode(binarySignature);

    // Final JWT token
    std::string sdkJWT = encodedHeader + "." + encodedPayload + "." + encodedSignature;
	LOG_INFO(TAG) << "sdkJWT: " << sdkJWT << endl;
	authContext.jwt_token = Utility::StringToWString(sdkJWT);
	LOG_INFO(TAG)<<"Authenticating Zoom SDK"<<endl;
	throwIfNotSuccess(authService->SDKAuth(authContext), __LINE__ );

	Timers::set_timer(TimerType::AuthenticationTimer, SDK_CALL_TIMEOUT);
}

```

**onAuthenticationReturn**

```auto
void ZoomController::onAuthenticationReturn(AuthResult authResult) {
	Timers::cancel_timer(TimerType::AuthenticationTimer);
	Json::Value logJson;
	logJson["authenticationReturn"]["authResult"] = authResult;
	logJson["authenticationReturn"]["authResultStr"] = Utility::WStringToString(authResultToString(authResult));
	LOG_INFO(TAG) << Utility::jsonToString(logJson);
	if (authResult == AUTHRET_SUCCESS)
		this->joinMeeting();
	else
		throw CUSTOM_EXCEPTION("Authentication failed with AuthResult = " + to_string(authResult));
}

```

---

<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:** [April 11, 2024, 5:14am UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/17 "2024-04-11T05:14:39Z")

</div>

@cai.zoom you mentioned this is working fine on your colleague’s machine?

The SDK keeps trying to call this URL `https://http://zoom.us/sdk/v2/auth` which is malformed has it has both https: and http:

Is there some services on your local machine which is doing URL / HTTPS redirects?

---

<div class="post-metadata">

**Author:** ![cai.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/cai.zoom/32/29704_2.png) [@cai.zoom](https://devforum.zoom.us/u/cai.zoom)\
**Post date:** [April 17, 2024, 12:41pm UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/18 "2024-04-17T12:41:10Z")

</div>

Glad to inform that this issue is resolved.  
Solution I had earlier set strWebDomain as L"[http://zoom.us](http://zoom.us)" and this was working fine for previous authentication method. But when shifting to JWT based auth set strWebDomain as L"[https://zoom.us](https://zoom.us)" . This will resolve the issue. cc @chunsiong.zoom Thanks for all the help.

---

<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:** [May 17, 2024, 10:41pm UTC](https://devforum.zoom.us/t/zoomcontroller-sdk-authenticate-getting-exception/107171/19 "2024-05-17T22:41:20Z")

</div>

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