# Zoom Sdk.onAuthorized is not called when I call authorize in the open app on Android

**URL:** <https://devforum.zoom.us/t/zoom-sdk-onauthorized-is-not-called-when-i-call-authorize-in-the-open-app-on-android/86897>\
**Category:** Zoom Apps\
**Created:** [April 18, 2023, 9:49am UTC](https://devforum.zoom.us/t/zoom-sdk-onauthorized-is-not-called-when-i-call-authorize-in-the-open-app-on-android/86897 "2023-04-18T09:49:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![n.asylov](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@n.asylov](https://devforum.zoom.us/u/n.asylov)\
**Post date:** [April 18, 2023, 9:49am UTC](https://devforum.zoom.us/t/zoom-sdk-onauthorized-is-not-called-when-i-call-authorize-in-the-open-app-on-android/86897/1 "2023-04-18T09:49:51Z")

</div>

**Zoom Apps Configuration**  
I am launching the application on Android, the zoom version of the application is 5.14.2 (13117).  
Zoom Apps SDK version 0.16.7.

```auto
const capabilities: Apis[] = [
  // Capabilities zoomSdk
  'authorize',
  'promptAuthorize',
  'onAuthorized',
  'shareApp',
  'getMeetingContext',
  'getMeetingUUID',
  'getUserContext',
  'openUrl',
  'getSupportedJsApis',
  'onMyUserContextChange',
];

private static async configureZoomSdk() {
  return await zoomSdk.config({
    size: { width: 700, height: 360 },
    capabilities,
  });
}

```

**Description**  
We add listening via `addEventListener` to the `onAuthorized` event.  
When we call `authorize` when opening an application on Windows, then `onAuthorized` is triggered and everything works. And when we open the application in Zoom on Android, then after calling `authorize`, we get the success status, but `onAuthorized` does not work.

**Error?**  
There are no errors thrown.

---

<div class="post-metadata">

**Author:** ![n.asylov](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@n.asylov](https://devforum.zoom.us/u/n.asylov)\
**Post date:** [April 18, 2023, 1:29pm UTC](https://devforum.zoom.us/t/zoom-sdk-onauthorized-is-not-called-when-i-call-authorize-in-the-open-app-on-android/86897/2 "2023-04-18T13:29:54Z")

</div>

After studying the code of your library, I came to the conclusion that you do not have a processing for `addEventListener`, in case `browser.type === 'android'`.

Are my guesses correct, if so, when will it be added?

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [April 21, 2023, 12:59am UTC](https://devforum.zoom.us/t/zoom-sdk-onauthorized-is-not-called-when-i-call-authorize-in-the-open-app-on-android/86897/3 "2023-04-21T00:59:26Z")

</div>

The onAuthorized event should work on Android devices. Can you share the code that you are using to set up the event?

---

<div class="post-metadata">

**Author:** ![n.asylov](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@n.asylov](https://devforum.zoom.us/u/n.asylov)\
**Post date:** [April 24, 2023, 8:39am UTC](https://devforum.zoom.us/t/zoom-sdk-onauthorized-is-not-called-when-i-call-authorize-in-the-open-app-on-android/86897/4 "2023-04-24T08:39:43Z")

</div>

```auto
const capabilities: Apis[] = [
  // Capabilities zoomSdk
  'authorize',
  'promptAuthorize',
  'onAuthorized',
  'shareApp',
  'getMeetingContext',
  'getMeetingUUID',
  'getUserContext',
  'openUrl',
  'getSupportedJsApis',
  'onMyUserContextChange',
];

private static async configureZoomSdk() {
  return await zoomSdk.config({
    size: { width: 700, height: 360 },
    capabilities,
  });
} 

public async initZoomSdk() {
  try {
    const zoom_sdk_init_data = await ZoomSdkService.configureZoomSdk();

    if (zoom_sdk_init_data) {
      this.logger.info('Success initialize zoomSdk');
    }

    return zoom_sdk_init_data;
  } catch (error) {
    this.logger.error('Failed initialize zoomSdk -', error);
    return null;
  }
}

...

constructor() {
  const onAuthorized = (ev) => {
    this.logger.info('ZoomSdk event listener: onAuthorized', ev, this.zoom_pkce);

    this.zoom_sdk_service.call('removeEventListener', 'onAuthorized', onAuthorized);
    // Our internal logic
  };

  this.zoom_sdk_service.call('addEventListener', 'onAuthorized', onAuthorized);
}

public async zoomSdkAuthorize() {
  this.zoom_pkce = generatePKCEPair();

  const res = await this.zoom_sdk_service.call('authorize', { codeChallenge: this.zoom_pkce.code_challenge });
  this.logger.info('ZoomSdk: authorize', res);
}

```

1. For the zoomSdk configuration, we use the `initZoomSdk` method, it outputs us `Successfully initialize zoomSdk`.
2. We call the `zoomSdkAuthorize` method. It outputs us `ZoomSdk: authorization { message: 'Success' }`.
3. At this moment, in the zoom desktop application, the event `onAuthorized` is triggered and outputs `ZoomSdk event listener: onAuthorized`, but not on Android.

P.s. `zoom_sdk_service.call` is just a wrapper method that calls zoomSdk methods and handles errors.

---

<div class="post-metadata">

**Author:** ![n.asylov](https://avatars.discourse-cdn.com/v4/letter/n/bc8723/32.png) [@n.asylov](https://devforum.zoom.us/u/n.asylov)\
**Post date:** [May 4, 2023, 1:13pm UTC](https://devforum.zoom.us/t/zoom-sdk-onauthorized-is-not-called-when-i-call-authorize-in-the-open-app-on-android/86897/5 "2023-05-04T13:13:22Z")

</div>

Is there any new information on my question?
