onMobileRTCAuthReturn never gets called on a valid JWT token

Description
I’m trying to integrate the iOS Meeting SDK, but I can’t authenticate the SDK with a JWT token.
The tokens are generated from our backend (as recommended) and I confirm they are valid.
They did work with MobileRTCSample and also my integration of Android Meeting SDK.

When I pass a valid JWT token and call authService.sdkAuth(), onMobileRTCAuthReturn from the delegate never gets called.
The weird thing is when I pass a expired JWT token, onMobileRTCAuthReturn is actually called and give this error MobileRTCAuthError_TokenWrong which is correct.
I don’t understand what I am missing here, I don’t see any major difference between the sample project and mine.

Thanks in advance for your help!

Which iOS Meeting SDK version?
5.15.12

To Reproduce(If applicable)
Steps to reproduce the behavior:

  1. Call authService.sdkAuth() with a valid JWT token
  2. onMobileRTCAuthReturn don’t get called

Code

class ZoomSDK: NSObject {
    private let instance = MobileRTC.shared()
    private var continuation: CheckedContinuation<MobileRTCAuthError, Never>?
    
    func authenticate(domain: String, jwtToken: String) async -> Bool {
        let context = MobileRTCSDKInitContext()
        context.domain = "zoom.us"
        context.enableLog = true
        context.locale = .default
        guard instance.initialize(context) else {
            Log.shared.e(message: "Could not initialize MobileRTC")
            return false
        }
        guard let authService = instance.getAuthService() else { return false }
        authService.delegate = self
        authService.jwtToken = jwtToken

        let value: MobileRTCAuthError = await withCheckedContinuation { continuation in
            self.continuation = continuation
            authService.sdkAuth()
        }
        return value == MobileRTCAuthError.success
    }    
}

extension ZoomSDK: MobileRTCAuthDelegate {
        
    func onMobileRTCAuthReturn(_ returnValue: MobileRTCAuthError) {
        print("onMobileRTCAuthReturn() - return: \(returnValue)")
        self.continuation?.resume(returning: returnValue)
    }   
}

1 Like

The issue seems to be related to the MobileRTC.shared().initialize method. Ensure that you call initialize only once during app startup, as calling it multiple times can lead to SDK authentication issues. Also, confirm that you are using the correct domain for the MobileRTCSDKInitContext.

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