# onMobileRTCLoginReturn not being called

**URL:** <https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283>\
**Category:** iOS\
**Created:** [April 30, 2021, 1:09pm UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283 "2021-04-30T13:09:58Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![officialmakkar](https://avatars.discourse-cdn.com/v4/letter/o/e19adc/32.png) [@officialmakkar](https://devforum.zoom.us/u/officialmakkar)\
**Post date:** [April 30, 2021, 1:09pm UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/1 "2021-04-30T13:09:58Z")

</div>

**Description**

This is how I setup my SDK

> class AppDelegate: UIResponder, UIApplicationDelegate, MobileRTCAuthDelegate {

> func setupSDK(sdkKey: String, sdkSecret: String) {  
> let context = MobileRTCSDKInitContext()  
> context.domain = “[zoom.us](http://zoom.us)”  
> context.enableLog = true
> 
> ```
> let sdkInitializedSuccessfully = MobileRTC.shared().initialize(context)
>     
> if sdkInitializedSuccessfully == true, let authorizationService = MobileRTC.shared().getAuthService() {
> authorizationService.clientKey = sdkKey
> authorizationService.clientSecret = sdkSecret
> authorizationService.jwtToken = "xxxxxxx"
> authorizationService.delegate = self
> authorizationService.sdkAuth()
> }
> }
> 
> ```

This is my callback method in AppDelegate.

> ```
> func onMobileRTCLoginReturn(_ returnValue: Int) {
> switch returnValue {
> case 0:
> print("Successfully logged in")
> 
> // This alerts the ViewController that login was successful. NotificationCenter.default.post(name: Notification.Name("userLoggedIn"), object: nil)
> case 1002:
> print("Password incorrect")
> default:
> print("Could not log in. Error code: \(returnValue)")
> }
> }
> 
> ```

This function called when user login

```
> func logIn(email: String, password: String) {
> if let authorizationService = MobileRTC.shared().getAuthService() {
> authorizationService.login(withEmail: email, password: password, rememberMe: false)
> }
> }

```

Can you please check this and let me know. Is it possible that my JWT token is expired that’s why login method is not called?

**Which iOS Client SDK version?**  
I’m using 5.2.42037.1112 version

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone 12]
- OS: [e.g. iOS 14.4]

---

<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:** [April 30, 2021, 7:52pm UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/2 "2021-04-30T19:52:07Z")

</div>

Hey @officialmakkar,

Thanks for using the dev forum!

The issue is that you are supplying both a client key/secret and a JWT. The SDK only needs a JWT, please remove those two lines.

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![officialmakkar](https://avatars.discourse-cdn.com/v4/letter/o/e19adc/32.png) [@officialmakkar](https://devforum.zoom.us/u/officialmakkar)\
**Post date:** [May 14, 2021, 9:57am UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/3 "2021-05-14T09:57:31Z")

</div>

> [@officialmakkar](#):
>
> `onMobileRTCLoginReturn`

Even after removing those two line I face same issue.

---

<div class="post-metadata">

**Author:** ![jon.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon.zoom/32/13495_2.png) [@jon.zoom](https://devforum.zoom.us/u/jon.zoom)\
**Post date:** [May 14, 2021, 5:02pm UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/4 "2021-05-14T17:02:15Z")

</div>

Hi @officialmakkar,

Can you please confirm whether or not you are receiving the [`onMobileRTCAuthReturn`](https://marketplacefront.zoom.us/sdk/meeting/ios/protocol_mobile_r_t_c_auth_delegate_01-p.html#a357545d6b0135f76baf1ea6545bb4dbb) callback before trying to log in? If so, what is the `returnValue` from that callback?

Thanks!

---

<div class="post-metadata">

**Author:** ![officialmakkar](https://avatars.discourse-cdn.com/v4/letter/o/e19adc/32.png) [@officialmakkar](https://devforum.zoom.us/u/officialmakkar)\
**Post date:** [May 15, 2021, 6:36am UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/5 "2021-05-15T06:36:18Z")

</div>

Perviously I used the device only SDK at that time `onMobileRTCAuthReturn` is called but later I used SDK for mobile and Simulator and I run the app on simulator but `onMobileRTCAuthReturn` is not fired.

---

<div class="post-metadata">

**Author:** ![officialmakkar](https://avatars.discourse-cdn.com/v4/letter/o/e19adc/32.png) [@officialmakkar](https://devforum.zoom.us/u/officialmakkar)\
**Post date:** [May 17, 2021, 5:52am UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/6 "2021-05-17T05:52:46Z")

</div>

No I run the app in actual device with iPhone X and I found `onMobileRTCAuthReturn` is not fire. Is it possible that if JWT is incorrect that reason `onMobileRTCAuthReturn` not trigger?

This is How i’m creating the JWT

> import SwiftyJWT
> 
> let alg = JWTAlgorithm.hs256(“secret”)  
> let headerWithKeyId = JWTHeader.init(keyId: “”)
> 
> ```
> var payload = JWTPayload()
> payload.customFields = ["app_key": EncodableValue(value: "jzf3f2-"),
> "version": EncodableValue(value: 1),
> "user_identity": EncodableValue(value: Global.user!.emp_zoom_user_id),
> "iat": EncodableValue(value: NSDate().timeIntervalSince1970),
> "exp":EncodableValue(value: NSDate().timeIntervalSince1970 + 5000),
> "tpc":EncodableValue(value: "12")]
>     
> let jwtWithKeyId = try? JWT.init(payload: payload, algorithm: alg, header: headerWithKeyId)
> 
> print(jwtWithKeyId)
> 
> ```

Can you please help me.

---

<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:** [May 17, 2021, 6:41pm UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/7 "2021-05-17T18:41:49Z")

</div>

Hey @officialmakkar,

I am suspecting that the JWT payload may be generated incorrectly. To verify this, can you create a JWT through [JWT.io](http://JWT.io) and hardcode it into your application to see if this above code is causing the issue? Instructions for doing so can be found here: ["auth sdk failed" when running zoom sdk demo - #7 by Michael\_Condon](https://devforum.zoom.us/t/auth-sdk-failed-when-running-zoom-sdk-demo/37448/7)

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![officialmakkar](https://avatars.discourse-cdn.com/v4/letter/o/e19adc/32.png) [@officialmakkar](https://devforum.zoom.us/u/officialmakkar)\
**Post date:** [May 30, 2021, 5:22pm UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/8 "2021-05-30T17:22:44Z")

</div>

Thanks for the reply I fixed the issue. Great support.

---

<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:** [June 1, 2021, 8:13pm UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/9 "2021-06-01T20:13:42Z")

</div>

Hey @officialmakkar,

Awesome! I am happy to hear 🙂  
Please let me know if there are any other issues.

Thanks!  
Michael

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [July 2, 2021, 6:14am UTC](https://devforum.zoom.us/t/onmobilertcloginreturn-not-being-called/49283/10 "2021-07-02T06:14:30Z")

</div>

Closed on July 2, 2021, 6:14am UTC

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