OK, the Zoom documentation is VERY frustrating. It’s often contradictive to itself, and I find myself going down rabbit holes with 20 tabs open and nothing actually working.
I am working on an existing Qt (c++) app, trying to add in the ability for our user to join an existing Zoom meeting. Using Windows Meetig SDK v5.11.4.7235. I want the app to join the meeting, not a Zoom user, which it’s my understanding I can do (join with just a display name).
From what I understand this takes:
- Initialize the SDK
- Authenticate the SDK via JWT
- Initialize meeting service
- Join a meeting “without login”
I have succeeded on steps 1-3, but 4 has been excruciating trying to find the correct docs or forum answers.
This is the code I have, based on docs, to join the meeting:
// Join meeting for API user with JoinParam object
ZOOM_SDK_NAMESPACE::JoinParam joinMeetingParam;
// Provide meeting credentials for API user using JoinParam4WithoutLogin
ZOOM_SDK_NAMESPACE::JoinParam4WithoutLogin joinMeetingWithoutLoginParam;
joinMeetingParam.userType = ZOOM_SDK_NAMESPACE::SDK_UT_WITHOUT_LOGIN;
// If there is a ZAK token for this user provide it here, otherwise use JoinParam4NormalUser instead
joinMeetingWithoutLoginParam.userZAK = L"<zak>";
joinMeetingWithoutLoginParam.meetingNumber = 123456;
joinMeetingWithoutLoginParam.psw = L"<psw>";
joinMeetingWithoutLoginParam.userName = L"<MY users name>";
joinMeetingParam.param.withoutloginuserJoin = joinMeetingWithoutLoginParam;
ZOOM_SDK_NAMESPACE::SDKError joinMeetingCallReturnValue(ZOOM_SDK_NAMESPACE::SDKERR_UNKNOWN);
joinMeetingCallReturnValue = meetingService->Join(joinMeetingParam);
if (joinMeetingCallReturnValue == ZOOM_SDK_NAMESPACE::SDKError::SDKERR_SUCCESS)
{
qDebug() << "Zoom should be in meeting!";
// Join meeting call succeeded, listen for join meeting result using the onMeetingStatusChanged callback
} else {
qDebug() << joinMeetingCallReturnValue;
}
Without a ZAK, I just get back joinMeetingCallReturnValue of 3 which is SDKERR_INVALID_PARAMETER
So, the frustrating part. I am trying to get my developer ZAK which accoording to various posts (I could link to the 50 pages of doc and posts I’ve been through that didn’t answer or contradicted others but that would be a mess) I can use to join a meeting without login, and I can obtain using keyword “me” in the api call, or using my dev email.
These are the last 2 requests I attempted.
If I try to get the ZAK directly (which some docs say I can)
QUrl reqUrl("https://api.zoom.us/v2/users/me/zak");
reqUrl.setPath(reqUrl.path());
QNetworkRequest req;
reqUrl.setUrl(QUrl::fromPercentEncoding(reqUrl.toEncoded()));
req.setUrl(reqUrl);
QString concatenated = "<clientkey>:<clientsecret>";
QByteArray header = concatenated.toLocal8Bit().toBase64();
QString headerData = "Basic "+header;
req.setRawHeader("Authorization", headerData.toLocal8Bit());
QNetworkReply* reply = m_nam.get(req);
connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(networkError(QNetworkReply::NetworkError)));
if (reply != NULL)
{
QNetworkReply::NetworkError error = reply->error();
if (error != QNetworkReply::NoError)
{
qDebug() << "Zoom API GET failed";
} else {
qDebug() << "Reply succeeded, attempt being made to GET...");
}
//reply->deleteLater();
}
else {
qDebug() << "Zoom API GET failed. No response received.");
}
Which I’ve also tried with “Bearer: ” instead of the Basic auth above, I always get to my NetworkError slot with “Host requires authentication”
So I figured maybe I can try the OAuth from Client method:
QUrl reqUrl("https://zoom.us/oauth/token?grant_type=client_credentials");
reqUrl.setPath(reqUrl.path());
QNetworkRequest req;
reqUrl.setUrl(QUrl::fromPercentEncoding(reqUrl.toEncoded()));
req.setUrl(reqUrl);
QString concatenated = "<clientkey>:<clientsecret>";
QByteArray header = concatenated.toLocal8Bit().toBase64();
QString headerData = "Basic "+header;
req.setRawHeader("Authorization", headerData.toLocal8Bit());
req.setRawHeader("Content-Type","application/json");
QNetworkReply* reply = m_nam.post(req,"");
if (reply != NULL)
{
QNetworkReply::NetworkError error = reply->error();
if (error != QNetworkReply::NoError)
{
qDebug() << "Zoom API POST failed";
}
//reply->deleteLater();
}
else {
qDebug() << "Zoom API POST failed. No response received.");
}
Then it appears to go through but I back Invalid response, no result object.
I’ve probably tried at least a dozen other variations based on docs/posts and nothing is working to get the ZAK. And what I don’t get is why if I’m using an SDK, which is already authenticated, do I have to even do separate API calls like this? The SDK should have c++ calls/objects to get this information at this stage in the code.