ZoomSDKAuthDelegate callbacks for login()

Description
I am using ZoomSDKAuthService in the mac app to log in users. The login request actually happens on an iPhone connected via bonjour, mac app responds with login status returned in this function

`func onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus, failReason reason: String)`

This is my code for login function and delegate callback:

  func login(
    _ userName: String,
    password: String,
    rememberMe: Bool,
    completion: @escaping LoginCompletion
  ) {
    loginCompletion = completion
//    sdk.getAuthService()?.logout()    //This is even magical ;)
    print("ZoomAuthService: login: start time: \(Date())")
    sdk.getAuthService().delegate = self
    sdk.getAuthService().login(userName, password: password, rememberMe: rememberMe)
  }

func onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus, failReason reason: String) {
    print("ZoomAuthService:onZoomSDKLogin(_ loginStatus: \(loginStatus), failReason reason: \(reason)")
    guard loginStatus == ZoomSDKLoginStatus_Success,
      let user = sdkAuthService?.getAccountInfo()?.zoomUser else {
        guard loginStatus == ZoomSDKLoginStatus_Failed else { return }
        print("ZoomAuthService: login failed: end time: \(Date())")
        loginCompletion?(
          Result.failure(
            NSError(
              domain: "ZoomAuthService",
              code: Int(loginStatus.rawValue),
              userInfo: ["message": reason]
            )
          )
        )
        return
    }
    print("ZoomAuthService: login successfule: end time: \(Date())")
    loginCompletion?(Result.success(user))
  }

I am facing a couple of issues related to the onZoomSDKLogin callback.

  1. It doesn’t get called if SDK did autologin and the user has already logged in once. If I call the SDK login function again for the same credentials, onZoomSDKLogin never gets called.
  2. If I uncomment the logout line before the login, So basically perform a logout before every login. I do receive onZoomSDKLogin callbacks most of the time but sometimes it takes up to 40 seconds.
    In the cases where it is taking more time login fails for valid credentials.

I am attaching some logs for my tests to show you the time difference between the callbacks. You can search for the logs for print statements from the above code. You can also find the print statements from onZoomSDKLogout. I have an assumption that login and logout calls are conflicting with each other hence the variation in response time. Good luck with that!

But I would like to know the reason for #1, I don’t understand why it should not send me an onZoomSDKLogin callback for every login call.

Is there any way to attach text files or code to this blog? You can find the logs on this gist.
ZoomSDKAuthError

Which version?
Tested with these versions:
v5.2.41751.1026
v5.2.41735.0929

I would appreciate a quick response on this as it is blocking current development.

Hi @j_a_z_z, thanks for using our SDK.

  1. It doesn’t get called if SDK did autologin and the user has already logged in once. If I call the SDK login function again for the same credentials, onZoomSDKLogin never gets called.

This is expected behavior. You will only get the callback if you are logging in for the first time (i.e. manually logging in).

If I uncomment the logout line before the login, So basically perform a logout before every login. I do receive onZoomSDKLogin callbacks most of the time but sometimes it takes up to 40 seconds.

We are unable to reproduce this delay, even after adding the logout call. The most likely explanation for this is adverse network conditions.

Thanks!

This is expected behavior. You will only get the callback if you are logging in for the first time (i.e. manually logging in).

Why this is not mentioned in the documentation then? If I understood this correctly, It will return me the SDK login result.
If the function succeeds, it will return ZoomSDKError_success, meanwhile it will return SDK login result when calling asynchronously onZoomSDKLogin.

/**
 * @brief Login ZOOM with email.
 * @param userName The email for login.
 * @param password The password for login.
 * @param rememberMe Set it to YES so that user can login automatically next time, otherwise not.
 * @return If the function succeeds, it will return ZoomSDKError_success, meanwhile it will return SDK login result when calling asynchronously onZoomSDKLogin.
 */
- (ZoomSDKError)login:(NSString*)userName Password:(NSString*)password RememberMe:(BOOL)rememberMe;

We are unable to reproduce this delay, even after adding the logout call. The most likely explanation for this is adverse network conditions.

Can you please elaborate on the adverse network condition? We have faced these issues on the day I posted and then they disappeared. Was there a downgraded service from zoom during that time?

Today again I have delays in login. >10 seconds.
ZoomAuthService: login: start time: 2020-12-01 16:35:45 +0000
ZoomAuthService: login successfule: end time: 2020-12-01 16:35:55 +0000

Hi @j_a_z_z, thanks for the response.

Why this is not mentioned in the documentation then?

We understand that our Mac OS SDK documentation is lacking in many areas and apologize for the inconvenience. While we work on improving our documentation, I will make note of this in particular so we can avoid similar misunderstandings in the future.

Can you please elaborate on the adverse network condition? We have faced these issues on the day I posted and then they disappeared. Was there a downgraded service from zoom during that time?

Simply put, if you are experiencing network connectivity issues, it is possible for them to affect your login times. According to our status page, there have not been any instances recorded of degraded service.

Any additional information you can provide which would assist with us reproducing this behavior would be extremely helpful. :slightly_smiling_face:

Thanks!

This is really annoying then. How do you expect other devs to use your SDK? When simple use cases like login are not even documented properly.

Can I request a proper documentation with all edge cases for ZoomSDKAuth.
Alternatively, Is it possible to schedule a call with your developers to understand what is going on in this black box!

Any additional information you can provide which would assist with us reproducing this behavior would be extremely helpful.

I am happy to share anything else required for this, but this is most of my code related to login. Please ask!

  • After the below login call, execution happens inside Zoom SDK
print("ZoomAuthService: login: start time: \(Date())")
sdk.getAuthService().delegate = self
sdk.getAuthService().login(userName, password: password, rememberMe: rememberMe)
  • Then it comes back here, I am printing the both logs as sent in previous messages. What else could be happening?
func onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus, failReason reason: String) {
print("ZoomAuthService:onZoomSDKLogin(_ loginStatus: \(loginStatus), failReason reason: \(reason)")

I think you can replicate the behaviour if you have tests for your SDKs public interfaces, keep trying sign in with the lines from my code.

@jon.lieblich I’m working on the same app as @j_a_z_z We’re in different locations with blazing fast internet and our login times vary wildly. I doubt it’s the network as it happens to all of us in different locations and different provinders. What can be done here? We cannot release an app that takes 10 seconds to sing in and sometimes it doesn’t even work at all. Can we have a call to demonstrate the issues to you? Or shall we record a video and post it here?

Just to give you and example @jon.lieblich

ZoomAuthService: login: start time: 2020-12-01 20:03:49 +0000
2020-12-01 21:03:49.233984+0100 Remote for Zoom[10186:450962] Mac Address: AC:87:A3:12:C9:44
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 3), failReason reason:
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 1), failReason reason:
ZoomAuthService: login successfule: end time: 2020-12-01 20:04:11 +0000

These are fat 20 seconds to log in and believe me it has nothing to do with our network!

Or this one @jon.lieblich

ZoomAuthService: login: start time: 2020-12-01 20:03:58 +0000
2020-12-01 21:03:58.503599+0100 Remote for Zoom[72237:2375994] Mac Address: F0:18:98:42:13:ED
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 3), failReason reason:
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 2), failReason reason:
ZoomAuthService: login failed: end time: 2020-12-01 20:08:35 +0000

Login failed after 5 minutes???

Hi @j_a_z_z and @tmiskiew, thank you for the additional information.

I understand that this behavior is undesirable. We will do our best to get to the bottom of what is causing these unacceptable login delays.

First, let’s get absolute confirmation that this delay is localized to the application you are building with the SDK. To do this, can one or both of you verify that these delays are never observed with the Zoom client? If there is never a delay when logging in with the Zoom client, we can confirm that there are no issues with your network.

If you do not observe the delay with the Zoom client, the next step would be to try the same approach with our sample application.

Please give these two a try and let me know whether or not the delay is present so we can start narrowing down where the issue is.

Thanks!

Hello @jon.lieblich

I did some tests in my app, I am sending requests from iOS app to mac OS apps on UDP using Network framework.
I removed the zoom SDK dependency from this flow and returning the mock response for login and logout. My connection code works flawlessly in this case. Without any delays.

As soon as I introduce zoom SDK, and do frequent login logout requests from iOS app, zoom SDK takes a lot of time to respond back with ZoomSDKLoginStatus codes.
I understand that zoom SDK works perfectly in the sample app even with the frequent login/logout calls.
But In the end, I am facing problems because of the delayed callbacks from the SDK.

To have an even better understand I tried to use Proxyman to record the API calls from zoom SDK.
I am really surprised that after receiving the Login requests, SDK took about 20 secs before calling the API and then another 10 seconds to return status after receiving the response back from login API.

These are the printed logs with times for two different sessions from the mac app

ZoomAuthService: login: start time: 2020-12-08 18:18:06 +0000
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 3), failReason reason: time: 2020-12-08 18:18:06 +0000
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 2), failReason reason: time: 2020-12-08 18:18:38 +0000
ZoomAuthService: login failed: end time: 2020-12-08 18:18:38 +0000


ZoomAuthService: login: start time: 2020-12-08 19:22:38 +0000
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 3), failReason reason: time: 2020-12-08 19:22:38 +0000
ZoomAuthService:onZoomSDKLogin(_ loginStatus: ZoomSDKLoginStatus(rawValue: 1), failReason reason: time: 2020-12-08 19:22:43 +0000
ZoomAuthService: login successfule: end time: 2020-12-08 19:22:43 +0000

As you can see, the time difference to move from status 3 to 2/1 is really high. It keeps increasing for subsequent login requests.

Here you can see login API request takes ~5 seconds in some cases, but still can’t justify the 30 seconds+ time.

Now that you have a better context about the problem, I would like to know a few things.

  1. How can zoom SDK be affected by a UDP server running inside the same mac app. There is no continuous data transfer going on rather, it is a request/response model. Think of it as a proxy for zoom SDK.
  2. How can I dig deep into the issue or maybe inside zoom SDK code to identify the problem, Is it possible?

I spent a lot of time trying to understand the problem and investigation, I think the problem could be related to memory or threading issues inside Zoom SDK, as continuous use of login/logout functions is degrading its performance.

It would be really great if We can have a call with Zoom developers to identify the issue, this is a blocker for us and we are already delayed for the app release.

Also, Can you please justify about 5 seconds for login API.

Hi @j_a_z_z, thank you for the additional info.

Can you please also provide the full logs from your application from a session where this delay occurs? We will investigate this and let you know as soon as we have an update.

Thanks!

@jon.lieblich These logs are from the same app where I am facing the delays, i.e. my mac app.
Please let me know what else is needed.

Hi @j_a_z_z,

The logs you have provided thus far are only your own debug logs. Please enable the SDK logs when initializing the SDK through ZoomSDKInitParams using the enableLog and logFileSize properties so that we may investigate this further.

Thanks!

@jon.lieblich
I already have the logs enabled in the project but zoom is not printing anything in the console. Where should I look for zoom specific logs?

Hey @jon.lieblich

I tried to look for the logs in ~/Library/Logs/"MyAppFolder" But the folder is empty.
This is the code to generate logs

    let params = ZoomSDKInitParams()
    params.needCustomizedUI = false
    params.enableLog = true
    params.logFileSize = 50
    sdk.initSDK(with: params)

Please let me know if I am missing something.

Hi @j_a_z_z,

This is the correct location of the logs. If they are not present there, there is likely something preventing Xcode from writing to that directory. Perhaps your privacy settings would be a good place to start looking? Unfortunately since I don’t have access to your environment, there is not much I can do to help beyond confirming that you are correctly enabling logs and looking in the right place for them.

Thanks!