How do I get the redirect URL for an OAuth connection

Highlighted
New Contributor

Hi;

 

I couldn't find a forum for questions on developer support so I'm guessing this is the closest. If this is the wrong forum please tell me where to post.

 

I am writing an application to connect to HubSpot using the cdata ADO.NET HubSpot connector.

 

I went and created a HubSpot application windward-test and that gave me a Client id and Client secret. However, the OAuth connection I am trying to create also needs a Redirect URL. How do I get this?

 

My app is a Windows Forms app so it does not have any url.

 

thanks - dave

 

 

Reply
0 Upvotes
4 Replies
Regular Advisor

Hi @DavidThielen 

 

You'll need a URL, usually on an external server, to complete the "round trip" for OAuth. 

 

The Redirect URL is typically where, and when, you'd save the access tokens from HubSpot.

 

If you're not using your App "in production" (on other people systems) you may be able to use the API Key appended to the URL:

 

https://developers.hubspot.com/docs/methods/auth/oauth-overview

 

Cheers

Mike

Reply
0 Upvotes
New Contributor

Hi;

Unfortunately having an actual URL won't work for our use case. This is for a commercial desktop app we are creating. So each user will have to create an OAuth Client ID & Secret from their account to use. As a desktop app, there's no web server involved. And because each user has their own, we can't create some general web service to handle this.

I tried the suggested

https://api.hubapi.com/contacts/v1/lists/all/contacts/all\?hapikey\=demo

And also tried replacing "demo" with our App ID. I get a 401.

Also, should I be passing in my username & password too? I am using the cdata driver & sample for this and it does not have a prompt for username & password. Is that the problem as opposed to the callback url?

thanks - dave

Reply
0 Upvotes
Regular Advisor

Hi Dave,

 

I got bitten with that with my first AJAX app... everything was working fine with the API Key and then I had to rebuild with OAuth2.

 

In your App can you run the OAuth2 round-trip on a screen in your app, then save the Access key & Refresh Token in your App?

 

You'll need to refresh the the Refresh Token whenever it's expired but it's only the initial approval that requires user intervention.

 

I assume that's how the HubSpot Mobile App works.

Mike

Reply
0 Upvotes
New Contributor

Unfortunately no. Our reporting engine can be running on a server where there is no screen and no user. We need to be able to open the connection without any user involvement and without any web server.

It's weird they require this - SharePoint allows any url for this as it ignores the setting.

Anyway, how can I connect to HubSpot for the use case of running on a server that does not have a web server and does not have a screen?

thanks - dave

Reply
0 Upvotes