# macOS ZoomSDKAuthDelegate callback not called in swift

**URL:** <https://devforum.zoom.us/t/macos-zoomsdkauthdelegate-callback-not-called-in-swift/52483>\
**Category:** macOS\
**Created:** [June 15, 2021, 1:17pm UTC](https://devforum.zoom.us/t/macos-zoomsdkauthdelegate-callback-not-called-in-swift/52483 "2021-06-15T13:17:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![niravd](https://avatars.discourse-cdn.com/v4/letter/n/9de0a6/32.png) [@niravd](https://devforum.zoom.us/u/niravd)\
**Post date:** [June 15, 2021, 1:17pm UTC](https://devforum.zoom.us/t/macos-zoomsdkauthdelegate-callback-not-called-in-swift/52483/1 "2021-06-15T13:17:00Z")

</div>

**Description**  
I have working macOS sample in objective-c but I am trying to make it in swift, so for the initial test I am trying to check auth, but auth works fine for Objective-c application, but not working on this sample code

> class ViewController: NSViewController, ZoomSDKAuthDelegate {  
> func onZoomSDKAuthReturn(\_ returnValue: ZoomSDKAuthError) {  
> print(returnValue)  
> }

```
func onZoomAuthIdentityExpired() {
    print("onZoomAuthIdentityExpired")
}

var _authService = ZoomSDKAuthService()
var helper : ZMSDKAuthHelper?

override func viewDidLoad() {
    super.viewDidLoad()
    let params = ZoomSDKInitParams()
    params.needCustomizedUI = true
    params.teamIdentifier = nil
    let initError = ZoomSDK.shared()!.initSDK(with: params)
    print(initError)
    let sdk = ZoomSDK.shared()!
    sdk.zoomDomain = "zoom.us"
    _authService = ZoomSDK.shared()!.getAuthService()!
    _authService.delegate = self
    let content = ZoomSDKAuthContext()
    content.jwtToken = "my token"

    let error = ZoomSDK.shared()!.getAuthService()!.sdkAuth(content)
    print(error)

}

```

}

**To Reproduce(If applicable)**  
Steps to reproduce the behavior:  
I tried running this above code providing my actual Auth Token but it shows me error as **ZoomSDKError(rawValue: 3)**

---

<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:** [June 15, 2021, 9:54pm UTC](https://devforum.zoom.us/t/macos-zoomsdkauthdelegate-callback-not-called-in-swift/52483/2 "2021-06-15T21:54:43Z")

</div>

Hi @niravd, thanks for the post.

It appears that you are setting the delegate incorrectly. You are instantiating a `ZoomSDKAuthService` object instead of using the one provided by the SDK. Please use the instance obtained through the `getAuthService` method to set the delegate instead.

Thanks!

---

<div class="post-metadata">

**Author:** ![niravd](https://avatars.discourse-cdn.com/v4/letter/n/9de0a6/32.png) [@niravd](https://devforum.zoom.us/u/niravd)\
**Post date:** [June 15, 2021, 11:39pm UTC](https://devforum.zoom.us/t/macos-zoomsdkauthdelegate-callback-not-called-in-swift/52483/3 "2021-06-15T23:39:00Z")

</div>

Hi @jon.zoom isn’t this the same what is written in the above code  
I am using the instance of getAuthService method to set the delegate

> \_authService = ZoomSDK.shared()!.getAuthService()!  
> \_authService.delegate = self

---

<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:** [June 16, 2021, 6:05pm UTC](https://devforum.zoom.us/t/macos-zoomsdkauthdelegate-callback-not-called-in-swift/52483/4 "2021-06-16T18:05:34Z")

</div>

Hi @niravd,

My apologies for missing that line in your post. Are you using Swift and Objective-C in the same project, or are you reproducing this in two different projects? It is possible for improper setup of the SDK to cause issues, but if you are using both languages in the same project, it is unlikely that that is the issue.

Thanks!

---

<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 17, 2021, 4:06am UTC](https://devforum.zoom.us/t/macos-zoomsdkauthdelegate-callback-not-called-in-swift/52483/5 "2021-07-17T04:06:26Z")

</div>

Closed on July 17, 2021, 4:06am UTC

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