Auth Service Event Listener

I am following the sample code: “Initialize Zoom SDK and create authentication service” found here:
Windows SDK functions (zoom.us)
It states:
// Call SetEvent to assign your IAuthServiceEvent listener
yourAuthServiceEventListener = new YourAuthServiceEventListener();

Could you provide an example of a class inherited from IAuthServiceEvent and how to pass it into the SetEvent method?

@dapto.kh ,

I would do something like this
AuthServiceEventListener* yourServiceEventListener= new AuthServiceEventListener();

authService.setEvent(yourServiceEventListener);

You will probably have 2 additional files

AuthServiceEventListener.cpp

#include "AuthServiceEventListener.h"
#include <iostream>

using namespace std;

AuthServiceEventListener::AuthServiceEventListener()
{
    
}

void AuthServiceEventListener::onAuthenticationReturn(ZOOM_SDK_NAMESPACE::AuthResult ret) {
    if (ret == ZOOM_SDK_NAMESPACE::AuthResult::AUTHRET_JWTTOKENWRONG)
    {
        // SDK Auth call failed because the JWT token is invalid.
        cout << "Auth failed: JWT Token is invalid." << endl;
    }
    else if (ret == ZOOM_SDK_NAMESPACE::AuthResult::AUTHRET_SUCCESS)
    {
        // SDK Authenticated successfully
        cout << "Auth succeeded: JWT." << endl;
    }
    else 
        cout << "Auth failed: " << ret << endl;
}

void AuthServiceEventListener::onLoginReturnWithReason(LOGINSTATUS ret, IAccountInfo* pAccountInfo, LoginFailReason reason)
{
    cout << "onLoginReturnWithReason: " << reason << endl;

}

void AuthServiceEventListener::onLogout()
{
    cout << "onLogout" << endl;
}

void AuthServiceEventListener::onZoomIdentityExpired()
{
    cout << "onZoomIdentityExpired" << endl;
}

void AuthServiceEventListener::onZoomAuthIdentityExpired()
{
    cout << "onZoomAuthIdentityExpired" << endl;
}

void AuthServiceEventListener::onNotificationServiceStatus(SDKNotificationServiceStatus status)
{
    cout << "onNotificationServiceStatus: " << status << endl;
}


AuthServiceEventListener.h

#pragma once
#include <windows.h>
#include <auth_service_interface.h>

using namespace ZOOMSDK;
class AuthServiceEventListener :
    public IAuthServiceEvent
{
	
public:
	AuthServiceEventListener();

	/// \brief Authentication result callback.
	/// \param ret Authentication result value.  For more details, see \link AuthResult \endlink enum.
	virtual void onAuthenticationReturn(AuthResult ret);

	/// \brief Callback of login result with fail reason.
	/// \param ret Login status. see \link LOGINSTATUS \endlink enum.
	/// \param pAccountInfo Valid when the ret is LOGINRET_SUCCESS. Otherwise NULL.
	/// \param reason Login fail reason. Valid when the ret is LOGIN_FAILED. Otherwise LoginFail_None. see \link LoginFailReason \endlink enum.
	virtual void onLoginReturnWithReason(LOGINSTATUS ret, IAccountInfo* pAccountInfo, LoginFailReason reason);

	/// \brief Logout result callback.
	virtual void onLogout();

	/// \brief Zoom identity has expired, please re-login or generate a new zoom access token via REST Api.
	virtual void onZoomIdentityExpired();

	/// \brief Zoom authentication identity will be expired in 10 minutes, please re-auth.
	virtual void onZoomAuthIdentityExpired();


	/// \brief Notification service status changed callback.
/// \param status The value of transfer meeting service. For more details, see \link SDKNotificationServiceStatus \endlink.
	virtual void onNotificationServiceStatus(SDKNotificationServiceStatus status);
};


This helps a lot. Thanks for your help Chun.

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