APIs & Integrations

KodyWright
Member

Trouble Installing Developer App - Bad Auth Code

Hi all,

I’m trying to install my developer application into my company’s Hubspot portal, I’m near the end of the process to complete the OAUTH flow however I’m having an issue that is preventing me from getting the access token. I’m using Postman to construct the request and I keep receiving this response:

{“status”:“BAD_AUTH_CODE”,“message”:“missing or unknown auth code”,“correlationId”:“4c05bb8b-5a2f-4646-bc18-074356cdc252”,“requestId”:“d4f849d1ab68c703ee9e7d690abecd90”}

The request is being made to: https://api.hubapi.com/oauth/v1/token

The client secret/ID are correct and I’m using the correct code received after visiting the link below and being redirected to the home page. (Client ID hidden on purpose… don’t know if I should do that or not).

https://app.hubspot.com/oauth/2675739/authorize?client_id=xxx&scope=contacts%20automation&redirect_u...

Is there a step I’m missing somewhere?

Thanks for the help!

0 Upvotes
14 Replies 14
spoorti1509
Member

Trouble Installing Developer App - Bad Auth Code

Could you please the code please as I am working as a Android developer trainee in app development company in Mexico. So I think it would help me If I get that code.

0 Upvotes
Umar_Jamil
Member

Trouble Installing Developer App - Bad Auth Code

@pmanca Kindly include the image of header as well. The body section is fine but its producing the same error.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Trouble Installing Developer App - Bad Auth Code

@Umar_Jamil The headers are in an image posted in the link above. Please review the other thread.

0 Upvotes
Umar_Jamil
Member

Trouble Installing Developer App - Bad Auth Code

@pmanca See the output with the same header and body as you told.

0 Upvotes
Umar_Jamil
Member

Trouble Installing Developer App - Bad Auth Code

@pmanca Thanks for the help! I really appreciate it. its work for me.

0 Upvotes
Vivek_Shankar_S
Member

Trouble Installing Developer App - Bad Auth Code

how could you share the code please

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Trouble Installing Developer App - Bad Auth Code

@Umar_Jamil i’m glad you got it working. Let us know if you run into anything else.

KodyWright
Member

Trouble Installing Developer App - Bad Auth Code

Odd, but I switched from sending data in raw format to form-url-encoded (like the image you attached) and it worked perfectly. Thanks for the help! I really appreciate it.

KodyWright
Member

Trouble Installing Developer App - Bad Auth Code

If you need I can paste the info with ID, secret and code. Not sure what all I should hide on these forums.

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Trouble Installing Developer App - Bad Auth Code

@KodyWright Nothing jumps out at me looking at that. Are you doing the second call right after the first? As the code can expire. About half way down this forum I share photos of what it looks like in postman to make the call.

Umar_Jamil
Member

Trouble Installing Developer App - Bad Auth Code

@pmanca What is included in the header in “Postman” because when i run my app its again giving BAD_AUTH_CODE error you have included the correct part in body section but the two statements given in the header was not shown kindly share that in a same way e.g Image. Thanks

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Trouble Installing Developer App - Bad Auth Code

@Umar_Jamil The link above has images to both the body and the headers. If you are having any trouble still, please start a new thread.

0 Upvotes
KodyWright
Member

Trouble Installing Developer App - Bad Auth Code

Sure thing, here’s the full code being sent.

POST /oauth/v1/token HTTP/1.1
Host: api.hubapi.com
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: 5c0ec2bf-36c5-ded0-9998-16da75a46361

grant_type=authorization_code&client_id=xxx&client_secret=xxx&redirect_uri=https%3A%2F%2Fwww.hubspot.com%2F%3Fcode%xxx

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Trouble Installing Developer App - Bad Auth Code

@KodyWright How are you formatting the call? Maybe you are not passing in the code correctly? Can I see an example of your call in postman?

0 Upvotes