# Zoom-sdk-ios does not call onMobileRTCAuthReturn if authentication fails using JWT

**URL:** <https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548>\
**Category:** iOS\
**Created:** [September 28, 2020, 9:49pm UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548 "2020-09-28T21:49:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sorousha](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sorousha/32/2762_2.png) [@sorousha](https://devforum.zoom.us/u/sorousha)\
**Post date:** [September 28, 2020, 9:49pm UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548/1 "2020-09-28T21:49:50Z")

</div>

**Description**  
When using a JWT for authentication, if the token is incorrect and authentication fails, onMobileRTCAuthReturn is never called.

**Which version?**  
[v5.0.24433.0616](https://github.com/zoom/zoom-sdk-ios/releases/tag/v5.0.24433.0616)

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:  
Create an incorrect token (for example wrong tokenExp). Example:  
{  
“appKey”: “actual key”,  
“iat”: 1601328575,  
“exp”: 1601336424,  
“tokenExp”: 1800 // this is wrong. it should be time since epoch  
}

**Additional context**  
Authenticate using  
let authService = MobileRTC.shared().getAuthService()  
authService!.delegate = self  
authService!.jwtToken = “the token”  
authService!.sdkAuth()

Note that calling sdkAuth when using key and secret, calls onMobileRTCAuthReturn if it fails. But in this case, it is never called in case of error.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [October 7, 2020, 6:09pm UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548/2 "2020-10-07T18:09:37Z")

</div>

Hey @sorousha

Thanks for using the dev forum!

I am sorry onMobileRTCAuthReturn isnt being called upon having an issue with the JWT. I have seen this issue here and there before. Are you using APIKey and APISecret from the Zoom Marketplace, or SDKKey and SDKSecret?

Michael

---

<div class="post-metadata">

**Author:** ![sorousha](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/sorousha/32/2762_2.png) [@sorousha](https://devforum.zoom.us/u/sorousha)\
**Post date:** [October 7, 2020, 8:35pm UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548/3 "2020-10-07T20:35:08Z")

</div>

Using SDK key and secret.

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [October 12, 2020, 5:08am UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548/4 "2020-10-12T05:08:03Z")

</div>

Hey @sorousha

The tokenExp should be in the same format as the other dates. For testing JWT’s, I use [https://www.epochconverter.com/](https://www.epochconverter.com/) to get the current epoch time, then on the same page I get the epoch time 24 hours in the future. I supply that value to both exp and tokenExp. Then I use [https://jwt.io/](https://jwt.io/) to debug the token. If you place valid parameters in the payload fields, then place your secret into the signature part of that page, you can copy the value on the left and paste it into your application. If your SDK Key/Secret accurately calls onMobileRTCAuthReturn, but the JWT does not. The JWT is indeed broken.

However, it is strange that knowingly putting in a bad JWT does not trigger onMobileRTCAuthReturn. I will let the team know. Thank you for bringing this to our attention!

Let us know if you have any other issues.  
Michael

---

<div class="post-metadata">

**Author:** ![pedmonston](https://avatars.discourse-cdn.com/v4/letter/p/3be4f8/32.png) [@pedmonston](https://devforum.zoom.us/u/pedmonston)\
**Post date:** [March 9, 2021, 9:10pm UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548/5 "2021-03-09T21:10:46Z")

</div>

I am experiencing the same issue, where putting in an intentionally bad JWT does not trigger a callback to `onMobileRTCAuthReturn` or `onMobileRTCAuthExpired`. Is there any way to be notified when `sdkAuth` fails in this way? Or is this a known issue with the SDK?

---

<div class="post-metadata">

**Author:** ![Michael\_Condon](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_condon/32/13543_2.png) [@Michael\_Condon](https://devforum.zoom.us/u/Michael_Condon)\
**Post date:** [March 9, 2021, 11:15pm UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548/6 "2021-03-09T23:15:20Z")

</div>

Hey @pedmonston,

Thanks for using the dev forum!

This is a known issue in the SDK that we hope to fix in the future.

Michael

---

<div class="post-metadata">

**Author:** ![jjasani](https://avatars.discourse-cdn.com/v4/letter/j/4491bb/32.png) [@jjasani](https://devforum.zoom.us/u/jjasani)\
**Post date:** [June 17, 2024, 10:22am UTC](https://devforum.zoom.us/t/zoom-sdk-ios-does-not-call-onmobilertcauthreturn-if-authentication-fails-using-jwt/31548/7 "2024-06-17T10:22:55Z")

</div>

Hello @Michael_Condon ,  
I am passing jwt valid token, still I am getting MobileRTCAuthError.tokenWrong in onMobileRTCAuthReturn(returnValue: MobileRTCAuthError) - this method.  
Do you have any idea what’s wrong with token?
