# iOS SDK JWT key not working

**URL:** <https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996>\
**Category:** iOS\
**Created:** [February 11, 2020, 12:16pm UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996 "2020-02-11T12:16:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![osemenyshyn](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@osemenyshyn](https://devforum.zoom.us/u/osemenyshyn)\
**Post date:** [February 11, 2020, 12:16pm UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/1 "2020-02-11T12:16:05Z")

</div>

**Description**

Steps:

1. On a base of CLIENT\_KEY and CLIENT\_SECRET generate in [jwt.io](http://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](http://JWT.io) format screenshot

 ![Screenshot 2020-02-11 at 14.07.17](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/7/7bc2246086bb9e9c3010a172975009f80f9cc438.png)

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

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [February 13, 2020, 1:51am UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/2 "2020-02-13T01:51:00Z")

</div>

Hi [osemenyshyn](https://devforum.zoom.us/u/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:

```auto
        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!

---

<div class="post-metadata">

**Author:** ![osemenyshyn](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@osemenyshyn](https://devforum.zoom.us/u/osemenyshyn)\
**Post date:** [February 14, 2020, 9:10am UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/3 "2020-02-14T09:10:13Z")

</div>

![Screenshot 2020-02-14 at 11.09.07](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/c/c4e53e8923fa87ed9b2aca6f71efa9d5feef617d.png)

---

<div class="post-metadata">

**Author:** ![osemenyshyn](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@osemenyshyn](https://devforum.zoom.us/u/osemenyshyn)\
**Post date:** [February 14, 2020, 12:57pm UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/4 "2020-02-14T12:57:00Z")

</div>

I tried different domains ([medicallyhome.zoom.us](http://medicallyhome.zoom.us) and [zoom.us](http://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?

= (

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [February 15, 2020, 12:55am UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/5 "2020-02-15T00:55:38Z")

</div>

Hi [osemenyshyn](https://devforum.zoom.us/u/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

```auto
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](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!

---

<div class="post-metadata">

**Author:** ![osemenyshyn](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@osemenyshyn](https://devforum.zoom.us/u/osemenyshyn)\
**Post date:** [February 26, 2020, 3:43pm UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/6 "2020-02-26T15:43:48Z")

</div>

> [@carson.zoom](#):
>
> 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
> 
> ```auto
> class AppDelegate: UIResponder, UIApplicationDelegate, MobileRTCAuthDelegate {
> ...
> }
> 
> ```

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?

---

<div class="post-metadata">

**Author:** ![carson.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/carson.zoom/32/785_2.png) [@carson.zoom](https://devforum.zoom.us/u/carson.zoom)\
**Post date:** [February 27, 2020, 3:28am UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/7 "2020-02-27T03:28:20Z")

</div>

Hi [osemenyshyn](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/6),

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 issueTimestamp + 1800 (30 mins, no max), here is an example:

```auto
{
  	"appKey": "string", // Your SDK key
"iat": 1582774049,
"exp": 1582848000
"tokenExp": 1582776049 (1582774049 + 2000)
}

```

Hope this helps. Thanks!

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 7:26pm UTC](https://devforum.zoom.us/t/ios-sdk-jwt-key-not-working/7996/8 "2020-08-21T19:26:22Z")

</div>


