IAuthService not return onAuthenticationReturn

Hi,
I created simple auth. to server but didn’t get onAuthenticationReturn.

Code example:

#include "stdafx.h"
#include "sdk_util.h"
#include <conio.h>

using namespace DuiLib;

class ZoomAuthService : public ZOOM_SDK_NAMESPACE::IAuthServiceEvent
{
public:
	ZoomAuthService() {}
	virtual ~ZoomAuthService() {}
	ZOOM_SDK_NAMESPACE::IAuthService* ZoomAuthService::GetAuthService() {
		if (m_pAuthService == nullptr) {
			ZOOM_SDK_NAMESPACE::CreateAuthService(&m_pAuthService);
			if (m_pAuthService)
			{
				m_pAuthService->SetEvent(this);
			}
		}
		return m_pAuthService;
	}
	virtual void onAuthenticationReturn(ZOOM_SDK_NAMESPACE::AuthResult ret) {
		printf("onAuthenticationReturn\n");
	}
	virtual void onLoginRet(ZOOM_SDK_NAMESPACE::LOGINSTATUS ret, ZOOM_SDK_NAMESPACE::IAccountInfo* pAccountInfo) {
		printf("onLoginRet\n");
	}
	virtual void onLoginReturnWithReason(ZOOM_SDK_NAMESPACE::LOGINSTATUS ret, ZOOM_SDK_NAMESPACE::IAccountInfo* pAccountInfo, ZOOM_SDK_NAMESPACE::LoginFailReason reason) {
		printf("onLoginReturnWithReason\n");
	}
	virtual void onLogout() {
		printf("onLogout\n");
	}
	virtual void onZoomIdentityExpired() {
		printf("onZoomIdentityExpired\n");
	}
	virtual void onZoomAuthIdentityExpired() {
		printf("onZoomAuthIdentityExpired\n");
	}


private:
	ZOOM_SDK_NAMESPACE::IAuthService* m_pAuthService = nullptr;
};

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE /*hPrevInstance*/, LPSTR /*lpCmdLine*/, int nCmdShow)
{
	AllocConsole();
	freopen("CONOUT$", "w", stdout);

	printf("Starting app\n");

	ZOOM_SDK_NAMESPACE::InitParam initParam;
	initParam.strWebDomain = L"https://zoom.us";
	initParam.enableLogByDefault = true;
	initParam.enableGenerateDump = true;

	auto err = ZOOM_SDK_NAMESPACE::InitSDK(initParam);
	if (ZOOM_SDK_NAMESPACE::SDKERR_SUCCESS != err) {
		printf("failed InitSDK\n");
		return -1;
	}
	
	ZoomAuthService server;
	auto authServer = server.GetAuthService();
	if (!authServer) {
		printf("failed GetAuthService\n");
		return -1;
	}


	ZOOM_SDK_NAMESPACE::AuthContext authParam;
	authParam.jwt_token = L"MY_TOKEN";
	err = authServer->SDKAuth(authParam);
	if(ZOOM_SDK_NAMESPACE::SDKERR_SUCCESS != err) {
		printf("failed SDKAuth\n");
		return -1;
	}

	printf("Waiting ...\n");
	getch();

	printf("Finished app\n");
	return 0;
}

Any help please?
Thanks

Hey @yuril,

Thanks for using the dev forum!

Is this a console application?

Thanks!
Michael

Yes it should be.
But in this example i used your demo by replacing main function

Hey @yuril,

When creating a console application the windows message handling must be added in manually. Similar to this post: joinSession Event callbacks are not fired - #11 by mtaha

Thanks!
Michael

Thanks you Michael
It helps me.

1 Like

Hey @yuril,

Awesome, I am happy to hear :slight_smile: Please let us know if you have any other questions.

Thanks!
Michael

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