Custom Redirect URI parameters?

Description
I’m looking to integrate some Zoom api calls into my company’s app. Quite simply, we just want to let users who have Zoom accounts to create meetings quickly by just clicking a button within our app.

I’m going through the example OAuth2 app and it all looks good, except for one thing. When a user authorizes this for the first time, we of course send them out to https://zoom.us/oauth/authorize, with all the necessary arguments.

When they come back into our app, we want to send them back to wherever they were. To accomplish this, there’s a bunch of state that we need to restore. The authorize endpoint seems to only send users back to a redirect_uri with the authorization code and nothing else, however. So when they come back into our app, we have no way of knowing what the user was doing before they left.

When interacting with other OAuth2 services-- including GSuite, Facebook, and so on-- we have the ability of customizing the redirect uri on a per-request basis, so that state information like this can be preserved by passing it through additional query string arguments. Is there no feature like this for Zoom API, or am I simply missing something?

Which App Type (OAuth / Chatbot / JWT / Webhook)?
OAuth

Which Endpoint/s?
authorize

Hey @sripberger, thanks for posting and using Zoom!

This is possible by attaching a state query param to the end of the installation url.

For example: https://zoom.us/oauth/authorize?response_type=code&client_id=XO8c5xFdQVqGAgGB3utlRA&redirect_uri=https://zoom.us&state=stateparam

Let me know if that helps!

Thanks,
Tommy

This should be exactly what I need. Thanks!

1 Like

You are welcome! :slight_smile:

-Tommy

Hi Tommy, does the redirect URI only allow the state param?

I was trying to use the next param in the redirect and it was working on development, but it just broke when I pushed to production with the Zoom API saying that I had a URI mismatch.

I’m still getting issues when using the state param instead of the next param. This is pretty frustrating / confusing :disappointed:.

In the Zoom OAuth docs, the documentation states that you need to pass a redirect_uri in most of the functions. Should this redirect_uri be a string with or without the state query param?

Hey @victor-zmurl,

The state param should not be attached to the redirect url while requesting an access token, it should only be on the authorize url:

https://zoom.us/oauth/authorize?response_type=code&client_id=7lstjK9NTyett_oeXtFiEQ&redirect_uri=https://yourapp.com&state={userState}

Basically the state is handled by Zoom, and not needed to pass in as the redirect url. So this url would also work:

https://zoom.us/oauth/authorize?response_type=code&client_id=7lstjK9NTyett_oeXtFiEQ&state={userState}&redirect_uri=https://yourapp.com

Thanks,
Tommy

@tommy How do you encode the state param if you want to use a javascript object? Could we use encodeURIComponent(JSON.stringify(object)) ?

Seems to throw an error on the API side

Hey @josharcher,

If you are using a JavaScript / JSON object as the state query param value, try base 64 encoding it:

Thanks,
Tommy