APIs & Integrations

davidrevis
Contributor

Need help with authorising my app

SOLVE

Hi, I've built an app to create a webhook to fire when a specific field changes on my deals in the CRM. 

 

I am not a  developer and am completely stuck when it comes to authorising my app to work on my hubspot portal. I have created the authorisation link which when i authorise it does return a code at the end when it redirects me to my redirect url.

 

It's the next step to get the access token that  i don't understand and i have trawled through all the hubspot help pages.

https://developers.hubspot.com/docs/methods/oauth2/get-access-and-refresh-tokens

 

I have tried adding the info described in the above Hubspot help page to https://www.apirequest.io but cant get it to work.

 

Has anyone got any suggestions or guides for dummies on how to complete the last step to authorise my app in my portal?

Thx

 

 

 

0 Upvotes
1 Accepted solution
davidrevis
Solution
Contributor

Need help with authorising my app

SOLVE

Just wanted to say, I managed to get this figured out by reading the following article and using the Google's OAuth 2.0 Playground to fire off the request. This made it a lot easier.

https://developers.hubspot.com/docs/faq/testing-hubspot-apis

View solution in original post

0 Upvotes
4 Replies 4
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Need help with authorising my app

SOLVE

Hey @davidrevis ,

 

You're on the right track using a rest client to complete the last step of the authorization, getting the access & refresh tokens. I think the issue might have to do with the rest client you're using, https://www.apirequest.io. Based on a quick look, I'm not seeing a native application/x-www-form-urlencoded option, which is the required format for the access/refresh token endpoint. Is it possible that the request body you're putting in isn't properly formatted?

 

I might recommend using a different rest client like Postman, which includes native support for application/x-www-form-urlencoded request bodies. Otherwise, you might be able to accomplish this with apirequest.io if you select the "raw" body option, and manually encode the request body. It'd look something like this:

grant_type=authorization_code&client_id=xxxxxxxx&client_secret=xxxxxxxxxx&redirect_uri=https://www.example.com&code=xxxxxxxxxx
0 Upvotes
davidrevis
Contributor

Need help with authorising my app

SOLVE

Thanks for your reply Derek, appreciate you trying to help. I looked at Postman. It seems a lot more complicated than the apirequest site I had been looking at. I had a play around and found where i can write the data but can't figure out how to fire/send my request.

 

I also tried your suggestion of putting all the data directly into the raw body option in apirequest.io but that didn't work either.  I got a message saying: 

 

"Error: Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.

If your site enforces CORS (i.e. Access-Control-Allowed-Origin is set to something other than *), then you may need to allow https://www.apirequest.io."

 

Sorry, I'm going beyond my ability as a marketeer here. The Hubspot UI is so easy to create my app/webhook, why is this step so much more difficult?

0 Upvotes
davidrevis
Solution
Contributor

Need help with authorising my app

SOLVE

Just wanted to say, I managed to get this figured out by reading the following article and using the Google's OAuth 2.0 Playground to fire off the request. This made it a lot easier.

https://developers.hubspot.com/docs/faq/testing-hubspot-apis

0 Upvotes
Derek_Gervais
HubSpot Alumni
HubSpot Alumni

Need help with authorising my app

SOLVE

Hey @davidrevis ,

 

Ah, apologies for missing that. I should have known that the CORS restriction would prevent the site you were using from successfully making the request. I'm glad you were able to use the OAuth playground to make the request! Postman can be a bit intimidating; I'll make a mental note to start off with the OAuth playground.

0 Upvotes