# Building an app with variable redirect urls

**URL:** <https://community.hubspot.com/t/building-an-app-with-variable-redirect-urls/133487>\
**Category:** APIs & Integrations\
**Tags:** oauth\
**Created:** [May 28, 2025, 7:20am UTC](https://community.hubspot.com/t/building-an-app-with-variable-redirect-urls/133487 "2025-05-28T07:20:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![FibreCRM-Simon](https://avatars.discourse-cdn.com/v4/letter/f/e47774/32.png) [@FibreCRM-Simon](https://community.hubspot.com/u/FibreCRM-Simon)\
**Post date:** [May 28, 2025, 7:20am UTC](https://community.hubspot.com/t/building-an-app-with-variable-redirect-urls/133487/1 "2025-05-28T07:20:57Z")

</div>

Hi!

My customers use HubSpot. I want to build an app that connects their HubSpot account to my own software app. In my Developer Account I have built the Public App with all the necessary Scopes etc.

The question I have what to put in the redirect url because each customer has their own unique URL to their software app.

So when I come to use the Install URL to install the app in their HubSpot account, the Install URL is incorrect for each customer app.

---

<div class="post-metadata">

**Author:** ![BrandonWoodruff](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/brandonwoodruff/32/61045_2.png) [@BrandonWoodruff](https://community.hubspot.com/u/BrandonWoodruff)\
**Post date:** [May 28, 2025, 1:24pm UTC](https://community.hubspot.com/t/building-an-app-with-variable-redirect-urls/133487/2 "2025-05-28T13:24:23Z")

</div>

Hello. For the URL, I would suggest building out your own redirect with your own web url. When doing a redirect, you can add a state parameter that containes their specific subdomain or customer id:

> **[HubSpot OAuth](https://app.hubspot.com/oauth/authorize)**

?client\_id=YOUR\_CLIENT\_ID  
&scope=contacts%20oauth  
&redirect\_uri=[https://yourdomain.com/oauth/callback](https://yourdomain.com/oauth/callback)  
&state=customer123  
I would then just build out your webapp to :  
- Receive the OAuth code and state

- Use the state to look up the customer that is making the request

- Complete the OAuth token exchange  
- Redirect the user to their specific instance based on the OAuth exchange and the state provided.  
Let me know if this helps! Hope you have a great day!
