iOS SDK JWT key not working

Description

Steps:

  1. On a base of CLIENT_KEY and CLIENT_SECRET generate in jwt.io token.

  2. Put this token in auth service:
    > MobileRTC.shared().initialize(context)
    > authService?.clientKey = CLIENT_KEY
    > authService?.clientSecret = CLIENT_SECRET
    > authService?.delegate = self
    *> *
    > authService?.jwtToken = JWT_Token
    > authService?.sdkAuth()

  3. MobileSDK not authorised sdk and method onMobileRTCAuthReturn not called.

Which version?
v4.4.57220.1211

Screenshots
JWT.io format screenshot

Additional context
Pls may somebody help me how to use this JWT to auth my sdk?

Hi osemenyshyn,

Thanks for using Zoom SDK. Did you set the web domain before the code snippet you shared? May I inquire what is the web domain you are using?

Please have a try with the following code snippet:

        let context = MobileRTCSDKInitContext();
        context.domain = "zoom.us";
        MobileRTC.shared().initialize(context);
        
        let authService = MobileRTC.shared().getAuthService();
        authService?.delegate = self;
        authService?.clientKey = "Your key here";
        authService?.clientSecret = "Your secret here";
        autheService?.jwtToken = JWT_Token;
        authService?.sdkAuth();

Hope this helps. Thanks!

I tried different domains (medicallyhome.zoom.us and zoom.us).
I tried as use SDKs’ keys (clientKey and clientSecret) as Web key and secret.
Nothing helped.

For now I just do only the one step => generate it in jwt io and put it locally.
Should JWT token be registered in Zoom by some extra Zoom API request?
Or I might just configure it in my jwtToken parameter in the project?

= (

Hi osemenyshyn,

Thanks for the reply and the screenshots. Could you have a try with the following:

  1. Comment out the jwtToken, and only use the clientKey & clientSecret, and make sure the key&secret are working. Please don’t forget to extend MobileRTCAuthDelegate in your class
class AppDelegate: UIResponder, UIApplicationDelegate, MobileRTCAuthDelegate {
...
}
  1. Once your key & secret is confirmed to be working, then following instructions in https://marketplace.zoom.us/docs/sdk/native-sdks/iOS/mastering-zoom-sdk/sdk-initialization to form the JWT token. If you are using JWT token, you do not need to use the field clientKey & clientSecret in authSerivce.

Hope this helps. Thanks!

This part works fine. JWT doesn’t (((
I’m sure I’m not correct generate JWT:

I use clientKey&clientSecret to generate JWT in JWT io

  1. Set clientKey in “appKey”
  2. Set Unix current timestamp (1582729214) to “iat”
  3. Set Unix current timestamp + expiration timestamp (1582739214) to “exp”
  4. Set expiration time (60) to “tokenExp”
  5. Set clientSecret in “your-256-bit-secret”

After I take generated jwt and put in authService?.jwtToken parameter.

Is everything fine? Or I miss something?

Hi osemenyshyn,

Thanks for the reply. The exp should be the timestamp when the JWT token expires. And the unit for tokenExp is sec, and the minimum value should be 1800 (30 mins, no max), here is an example:

{
  	"appKey": "string", // Your SDK key
"iat": 1582774049,
"exp": 1582848000
"tokenExp": 2000
}

Hope this helps. Thanks!