# Error calling authorize API immediately after loading the app when using in-client auth

**URL:** <https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111>\
**Category:** Zoom Apps\
**Created:** [May 17, 2022, 1:42pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111 "2022-05-17T13:42:52Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![jaaydenh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jaaydenh/32/36112_2.png) [@jaaydenh](https://devforum.zoom.us/u/jaaydenh)\
**Post date:** [May 17, 2022, 1:42pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/1 "2022-05-17T13:42:52Z")

</div>

Its my understanding that when using in-client auth, the user does not yet have an oauth token. My goal here is to call the authorize api to get the oauth token when loading the app immediately after in-client auth is completed and the app is installed.

I am getting the following error:  
 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/4/a/4a96388af4fdf8e5404ffbb0c4a7f0e1bda98594.png)

I can also see that the following request in the next screenshot is being made with the pasted payload below:

 ![image (1)](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/e/e/ee2ec0755cbb19b7879b0946a6965d6be9b714f7.png)

Payload:

```auto
[{"originUri":"/zoomapp/authorize","ts":1652792367310,"to":1,"userAgent":{"os":"Mozilla/5.0 ZoomWebKit/537.36 (KHTML, like Gecko) ZoomApps/1.0"},"type":"pageGesture","data":{"path":"/zoomapp/authorize","fid":1,"lcp":720.299,"cls":0,"tbt":0},"uri":"https://marketplace.zoom.us/zoomapp/authorize?_x_zm_rhtaid=425&_x_zm_rtaid=n_KdqtJRSqiq_0gm0rLnlg.1652792356736.2934a85ffef4d4a3396e95007f554973&client_id=dr0svDgWTCK4rG_GcrObEQ&redirect_uri=https://jayden-1.ngrok.zoom.gc-internal.net/&refreshtoken=true&response_type=code"}]

```

Are there any required parameters or any other instructions for how to correct use the authorize api?

---

<div class="post-metadata">

**Author:** ![Robert.Wallis](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/robert.wallis/32/38438_2.png) [@Robert.Wallis](https://devforum.zoom.us/u/Robert.Wallis)\
**Post date:** [May 17, 2022, 2:48pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/2 "2022-05-17T14:48:32Z")

</div>

The `o[t] is not a function` issue was addressed with SDK 0.14, is that the version you are using?

---

<div class="post-metadata">

**Author:** ![jaaydenh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jaaydenh/32/36112_2.png) [@jaaydenh](https://devforum.zoom.us/u/jaaydenh)\
**Post date:** [May 17, 2022, 9:22pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/4 "2022-05-17T21:22:41Z")

</div>

@Robert.Wallis Using js sdk 0.14 did resolve the error. However, now I am seeing this error page after initiating in-client auth and using the authorize api. I am not seeing any relevant logs/error messages.

 ![Screen Shot 2022-05-17 at 23.18.20](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/9/b/9b3ef13c67831e77e94d506155aec7993a3e95b0.png)

I made sure to add the home url to the oauth allow list.

Any ideas?

---

<div class="post-metadata">

**Author:** ![JonStewart](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jonstewart/32/36192_2.png) [@JonStewart](https://devforum.zoom.us/u/JonStewart)\
**Post date:** [May 18, 2022, 8:39pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/5 "2022-05-18T20:39:29Z")

</div>

Hi Jaayden. ‘authorize’ is not a method on the js sdk … yet. Try this:

```auto
    zoomSdk.callZoomApi("authorize", <authorizeOptions code_challenge and state>)
      .then((response) => {
        console.log(response);
      })
      .catch((e) => {
        console.log(e);
      });

```

---

<div class="post-metadata">

**Author:** ![JonStewart](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jonstewart/32/36192_2.png) [@JonStewart](https://devforum.zoom.us/u/JonStewart)\
**Post date:** [May 18, 2022, 8:40pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/6 "2022-05-18T20:40:57Z")

</div>

Next step here btw: You’ll need to register an onAuthorized event listener (with the js sdk) which will receive the authorization code. The rest you do server side (eg swap code for auth token)

---

<div class="post-metadata">

**Author:** ![JonStewart](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jonstewart/32/36192_2.png) [@JonStewart](https://devforum.zoom.us/u/JonStewart)\
**Post date:** [May 18, 2022, 8:54pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/7 "2022-05-18T20:54:17Z")

</div>

If none of the ideas above work, try watching the dev tools network panel during the whole process. Likely there is a call to marketplace that is failing. If you can grab that, feel free to post here

---

<div class="post-metadata">

**Author:** ![jaaydenh](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jaaydenh/32/36112_2.png) [@jaaydenh](https://devforum.zoom.us/u/jaaydenh)\
**Post date:** [May 20, 2022, 2:21pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/8 "2022-05-20T14:21:11Z")

</div>

When I switched from zoomSdk.callZoomApi(‘authorize’  
to zoomSdk.authorize()  
I stopped seeing the generic error and I am now getting a response from authorize. The next issue I am having is I am getting the error message `Error: Validation error, please check API parameters.`

In the docs, it seems like startAuthorize is the same api with the old name. In the docs it says the parameters are optional but the error message makes it seem like this is not the case.

```auto
zoomSdk.callZoomApi("startAuthorize", {
  "state": optional string, provided by developer
  "codeChallenge": optional string, provided by developer
})

```

---

<div class="post-metadata">

**Author:** ![JonStewart](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jonstewart/32/36192_2.png) [@JonStewart](https://devforum.zoom.us/u/JonStewart)\
**Post date:** [May 20, 2022, 4:25pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/9 "2022-05-20T16:25:01Z")

</div>

Try at minimum calling this method with a second argument equal to an object with a codeChallenge OR code\_challenge field

---

<div class="post-metadata">

**Author:** ![jon6](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon6/32/32915_2.png) [@jon6](https://devforum.zoom.us/u/jon6)\
**Post date:** [June 20, 2022, 3:31pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/10 "2022-06-20T15:31:58Z")

</div>

I’m experiencing the same issue that @jaaydenh is experiencing with 0.14.

 ![Screen Shot 2022-06-19 at 8.00.35 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/8/6/862436f711f044ab9363f869e7d3f0266eafaf63.png)

If I inspect the webview before initiating the auth (with the one client test method) it shows these errors in the marketplace app.

 ![Screen Shot 2022-06-19 at 8.02.03 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/e/d/eda80553aa855943d9e5091c6ff70a01630c3296.png)

---

<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:** [June 22, 2022, 5:49pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/12 "2022-06-22T17:49:47Z")

</div>

@jon6 Are you calling the API with a code challenge when you see this issue?

---

<div class="post-metadata">

**Author:** ![jon6](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jon6/32/32915_2.png) [@jon6](https://devforum.zoom.us/u/jon6)\
**Post date:** [June 29, 2022, 10:23pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/13 "2022-06-29T22:23:22Z")

</div>

Hi @MaxM sorry for the delayed response. We’ve had to put this on the back burner to get to release but I will follow up when we can loop back to this. I believe we did but I will confirm when I look again.

---

<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:** [July 5, 2022, 7:06pm UTC](https://devforum.zoom.us/t/error-calling-authorize-api-immediately-after-loading-the-app-when-using-in-client-auth/69111/14 "2022-07-05T19:06:48Z")

</div>

@jon6 Thanks for keeping me posted 🙂
