# Using Multiple Environments for the same user

**URL:** <https://devforum.zoom.us/t/using-multiple-environments-for-the-same-user/31279>\
**Category:** API and Webhooks\
**Created:** [September 25, 2020, 8:06am UTC](https://devforum.zoom.us/t/using-multiple-environments-for-the-same-user/31279 "2020-09-25T08:06:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![workgena](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/workgena/32/15921_2.png) [@workgena](https://devforum.zoom.us/u/workgena)\
**Post date:** [September 25, 2020, 8:06am UTC](https://devforum.zoom.us/t/using-multiple-environments-for-the-same-user/31279/1 "2020-09-25T08:06:10Z")

</div>

**Description**

Lets say we have one Zoom application in marketplace with  
Redirect URL for OAuth == `https://any.yourapp.com`

And two(it can be more) subdomain:

- `https://sub1.yourapp.com`
- `https://sub2.yourapp.com`

John Doe works with sub1 and sub2 and wants to use his Zoom account in both subdomains at the same time. Internally in sub1 and sub2 it is two not related users, but linked to single Zoom account.

Let’s say a user “John Doe” did authorization in sub1. And he successfully received “Bearer” token.

Then, “John Doe” goes to `https://sub2.yourapp.com` and do authorization for sub2. And he receives Bearer token as well.

**Error**

But, after that, the Bearer-token stored in sub1 is “Invalid access token.”

Try to `https://api.zoom.us/v2/users/me` with Bearer from sub1 - fail, sub2 - success

**Expectation**

The “sub1” and “sub2” authorization flow is not related and it should be two independent(isolated) Bearer tokens for each domain.

As I understand Zoom treats Authorization/Token requests for sub1 and sub2 as the same thing. Yes, the Auth/Token requests has the same `client_id` and the only difference is `redirect_uri`. But I thought “Multiple Environments” are independent. Now, they are conflicting, each new Authorization process makes previous(on different subdomain) invalid.

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

> **[OAuth 2.0 - Authorization - Documentation](https://marketplace.zoom.us/docs/guides/auth/oauth#using-multiple-environments)**
>
> OAuth with Zoom
> 
> The Zoom API uses OAuth 2.0 to authenticate and authorize users to make requests. To setup access credentials and request scopes for yo...

**Which Endpoint/s?**  
To get Bearer token, for each domain I use flow:

1. `https://zoom.us/oauth/authorize?...&redirect_url=sub1...` (or sub2)  
then
2. `https://zoom.us/oauth/token`
3. User Bearer token for `https://api.zoom.us/v2/users/me`

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 28, 2020, 4:41pm UTC](https://devforum.zoom.us/t/using-multiple-environments-for-the-same-user/31279/2 "2020-09-28T16:41:46Z")

</div>

Hi @workgena,

If you’re using 1 Oauth App, you’ll need to redirect to the respective environment by whitelisting your environment domain names—can you confirm you’ve whitelisted these in your app? Due note that the Redirect URL and whitelist URLs need to have the same base domain. So you should add a sub domain redirect for each environment.

You might also find this thread helpful:

> [@Does zoom support more than two environments for oauth2?](https://devforum.zoom.us/t/does-zoom-support-more-than-two-environments-for-oauth2/11052):
>
> Description Currently, I can enter only two redirect URIs one for development and one for production. Our application has three environments: development, staging, and production. Should I redirect staging users to the development URI after the authorize request? Or maybe create one zoom app for my development environment and one zoom app for staging and production? What’re your recommendations? Another question: Does it safe to expose the authorization code to the user (browser)? Not the …

Let me know if this helps!

Thanks,  
Will

---

<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:** [October 29, 2020, 2:41am UTC](https://devforum.zoom.us/t/using-multiple-environments-for-the-same-user/31279/3 "2020-10-29T02:41:59Z")

</div>

Closed on October 29, 2020, 2:41am UTC

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