APIs & Integrations

daveboerner
Participant

403 response for AccessToken

SOLVE

I'm getting a 403 response when trying to obtain an access token through oauth.

 

The error is:

This distribution is not configured to allow the HTTP request method that was used for this request. The
distribution supports only cachable requests.
 
I don't use Amazon (I'm just trying to request the token through postman), this error seems to be originating from hubspot, but I don't see anywhere for me to enable POST operation.
 
My operation looks like:
 
 
Any ideas?
0 Upvotes
1 Accepted solution
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

403 response for AccessToken

SOLVE

Hey @daveboerner,

 

If you're sure that the authorization code is correct, could you check if the content type header is as follow:

 

Content-Type: application/x-www-form-urlencoded;charset=utf-8

 

It is possible that by not having the correct content-type, it can throw off a server trying to read your request.

View solution in original post

6 Replies 6
WendyGoh
HubSpot Employee
HubSpot Employee

403 response for AccessToken

SOLVE

Hey @daveboerner,

 

You're seeing this error because the step Initiate an integration with OAuth 2.0 isn't configured to accept any GET/POST method. 

 

It is an authorization url that would request a browser. 

 

If you're building an app, your team would need to create a get route handler to redirect users to the authorization url. Next, from the get route handler, obtain the code from the redirected uri and exchange it for tokens. 

0 Upvotes
daveboerner
Participant

403 response for AccessToken

SOLVE

Hi @WendyGoh 

 

I'm sure I'm setting something up incorrectly through postman, but not sure what.

 

Here's the OAuth setup I'm using:

HBPostman.png

 

I am getting the popup to authorize, but the response I get back is :

Error: Could not complete OAuth 2.0 token request: {"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<HTML><HEAD><META HTTP-EQUIV":"\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n<TITLE>ERROR: The request could not be satisfied</TITLE>\n</HEAD><BODY>\n<H1>403 ERROR</H1>\n<H2>The request could not be satisfied.</H2>\n<HR noshade size=\"1px\">\nThis distribution is not configured to allow the HTTP request method that was used for this request. The distribution supports only cachable requests.\nWe can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.\n<BR clear=\"all\">\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\n<BR clear=\"all\">\n<HR noshade size=\"1px\">\n<PRE>\nGenerated by cloudfront (CloudFront)\nRequest ID: Bk8DtPUESyFFPmDPrcy_crqTejSGqqJvTJidnW5mbK8PCuHtl5764Q==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>"}

0 Upvotes
WendyGoh
HubSpot Employee
HubSpot Employee

403 response for AccessToken

SOLVE

Hey @daveboerner,

 

As I mentioned on my previous response, the step Initiate an integration with OAuth 2.0 isn't configured to accept any GET/POST method. This means that you wouldn't be able to use Postman to call this endpoint as it is not an endpoint. 

 

It is an authorization url that would request a browser. i.e. htttps://www.googe.com. 

 

You wouldn't be able to call https://www.google.com over Postman as it is a browser url. 

0 Upvotes
daveboerner
Participant

403 response for AccessToken

SOLVE

Thanks @WendyGoh , this should have been possible through Postman but fine I did it via the browser and got the code back.

 

When trying to exchange the code for the access token/refresh pair I'm getting this error:

 

"status": "BAD_GRANT_TYPE",
"message": "missing or unknown grant type",
"correlationId": "2bd49
 
Not sure what's wrong , my POST looks correct to me...
 
0 Upvotes
WendyGoh
Solution
HubSpot Employee
HubSpot Employee

403 response for AccessToken

SOLVE

Hey @daveboerner,

 

If you're sure that the authorization code is correct, could you check if the content type header is as follow:

 

Content-Type: application/x-www-form-urlencoded;charset=utf-8

 

It is possible that by not having the correct content-type, it can throw off a server trying to read your request.

daveboerner
Participant

403 response for AccessToken

SOLVE

That was it @WendyGoh thanks so much!