include <unistd.h>
#include <iostream>
#include <string>
#include "auth_service_interface.h"
#include "meeting_service_interface.h"
#include "zoom_sdk.h"
#include "zoom_sdk_def.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
USING_ZOOM_SDK_NAMESPACE
class MeetingServiceEventListener : public IMeetingServiceEvent {};
class Main : public IAuthServiceEvent {
private:
IAuthService *_authService;
IMeetingService *_meetingService;
uint64_t _meetingNumber;
std::string _sessionName;
std::string _apiKey;
std::string _apiSecret;
public:
Main() {
uint64_t meetingNumber = 4452252955; // replace with real
std::string sessionName = std::to_string(meetingNumber);
std::string apiKey = "...";
std::string apiSecret = "...";
_meetingNumber = meetingNumber;
_sessionName = sessionName;
_apiKey = apiKey;
_apiSecret = apiSecret;
InitParam initParam;
initParam.strWebDomain = "https://zoom.us";
initParam.strSupportUrl = "https://zoom.us";
initParam.emLanguageID = LANGUAGE_English;
initParam.enableLogByDefault = true;
initParam.enableGenerateDump = true;
SDKError err = InitSDK(initParam);
if (err != SDKERR_SUCCESS) {
std::cout << "Failed to init SDK." << err << std::endl;
}
SDKError authServiceInitReturnVal = CreateAuthService(&_authService);
if (authServiceInitReturnVal != SDKError::SDKERR_SUCCESS) {
std::cout << "Failed to init Auth Service." << err << std::endl;
}
SDKError meetingServiceInitReturnVal =
CreateMeetingService(&_meetingService);
if (meetingServiceInitReturnVal != SDKError::SDKERR_SUCCESS) {
std::cout << "Failed to init meeting service. "
<< meetingServiceInitReturnVal << std::endl;
}
}
void onAuthenticationReturn(ZOOM_SDK_NAMESPACE::AuthResult ret) {
std::cout << "Authentication result: " << _authService->GetAuthResult()
<< std::endl;
if (ret == AuthResult::AUTHRET_JWTTOKENWRONG) {
std::cout << "JWT token is wrong." << std::endl;
// SDK Auth call failed because the JWT token is invalid.
} else if (ret == AuthResult::AUTHRET_SUCCESS) {
std::cout << "Auth return success." << std::endl;
join();
} else {
std::cout << "Something else went wrong: " << ret << std::endl;
//QCoreApplication::exit(1);
}
}
void onLoginReturnWithReason(LOGINSTATUS ret, IAccountInfo *pAccountInfo,
LoginFailReason reason) {
std::cout << "Login return with reason." << reason << std::endl;
}
void onLogout() { std::cout << "Logout" << std::endl; }
void onZoomIdentityExpired() {
std::cout << "Zoom identity expired" << std::endl;
}
void onZoomAuthIdentityExpired() {
std::cout << "Zoom auth identity expired" << std::endl;
}
void Run() {
int r = run();
if (r != 0) {
}
}
int run() {
AuthContext authContext;
std::string token = "xxxxxx";
authContext.jwt_token = token.c_str();
std::cout << "Using token: " << authContext.jwt_token << std::endl;
// Create IAuthService object to perform Auth actions
SDKError authCallReturnValue(SDKERR_UNAUTHENTICATION);
SDKError errSetEvent = _authService->SetEvent(this);
if (errSetEvent != SDKError::SDKERR_SUCCESS) {
std::cout << "Failed to set authListener. " << errSetEvent
<< std::endl;
return 1;
}
authCallReturnValue = _authService->SDKAuth(authContext);
if (authCallReturnValue != SDKError::SDKERR_SUCCESS) {
std::cout << "Failed to auth SDK. " << authCallReturnValue
<< std::endl;
return 1;
}
return 0;
}
int join() {
ZOOM_SDK_NAMESPACE::JoinParam joinParam;
joinParam.userType = ZOOM_SDK_NAMESPACE::SDK_UT_WITHOUT_LOGIN;
ZOOM_SDK_NAMESPACE::JoinParam4WithoutLogin &withoutloginParam =
joinParam.param.withoutloginuserJoin;
withoutloginParam.meetingNumber = _meetingNumber;
withoutloginParam.vanityID = NULL;
withoutloginParam.userName = "testing";
withoutloginParam.psw = "";
withoutloginParam.customer_key = NULL;
withoutloginParam.webinarToken = NULL;
withoutloginParam.isVideoOff = true;
withoutloginParam.isAudioOff = false;
SDKError joinErr = _meetingService->Join(joinParam);
if (joinErr != SDKError::SDKERR_SUCCESS) {
std::cout << "Failed to join meeting. " << joinErr << std::endl;
return 1;
}
return 0;
}
};
static Main *mainInstance = NULL;
void Run() { mainInstance->Run(); }
int main(int argc, char **argv) {
mainInstance = new Main();
Run();
Display *display = XOpenDisplay(NULL);
if (display == NULL) {
return 1;
}
Window rootWindow = DefaultRootWindow(display);
XEvent event;
Atom wmDeleteMessage = XInternAtom(display, "WM_DELETE_WINDOW", False);
while (true) {
XNextEvent(display, &event);
switch (event.type)
{
case Expose:
printf("Expose\n");
break;
case ClientMessage:
if (event.xclient.data.l[0] == wmDeleteMessage)
break;
default:
break;
}
}
XCloseDisplay(display);
return 0;
}
there is my sample code,how can get the auth callback?
there is my sample code,how can get the auth callback?
i try it, get this errror
AuthSDK:success
Auth failed: 5
yes ,i do it, token and meeting_number and meeting_password
os is ubuntu22, 6.2.0-34-generic
i put record_toking same as token,the program in print
AuthSDK:success
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
Auth failed: 5
@15107478682 I’ve just tried the code from scratch and it works.
-
Pull the code from github.
-
Add h folder to demo/include
-
Add qt_lib folder to demo/lib/zoom_meeting_sdk
-
Add these files to demo/lib/zoom_meeting_sdk
-
Generate a JWT token, and put it in
config.txt
-
Add my own Meeting ID and password to
config.txt
-
Do
cmake -B build
in /demo/ folder -
Do
make
in /demo/build folder -
Run
/demo/bin/meetingSDKDemo
There might be additional steps needed if you are getting the ASLA error
apt-get install pulseaudio pulseaudio-util
# enable dbus
mkdir -p /var/run/dbus
dbus-uuidgen > /var/lib/dbus/machine-id
dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address
# add root
adduser root pulse-access
adduser root audio
# Cleanup to be "stateless" on startup, otherwise pulseaudio daemon can't start
rm -rf /var/run/pulse /var/lib/pulse /root/.config/pulse
cp /etc/pulse/* ~/.config/pulse/
pulseaudio -D --exit-idle-time=-1
# Create a virtual speaker output
pactl load-module module-null-sink sink_name=SpeakerOutput
pactl set-default-sink SpeakerOutput
pactl set-default-source SpeakerOutput.monitor
#make config file
mkdir ~/.config
echo -e "[General]\nsystem.audio.type=default" > ~/.config/zoomus.conf
i try it ,and there is no ASLA error,but auth callback is still 5, the 5 is mean?
AuthSDK:success
Auth failed: 5
Can any logs indicate what happened here? AUTHRET_UNKNOWN
the sdk version zoom-meeting-sdk-linux_x86_64-5.16.2.8878
I’ll PM you for your JWT token
Update: issue resolved, restarting virtualbox resolved the error.