Trouble Installing Developer App - Bad Auth Code

New Member

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!

Reply
0 Upvotes
14 Replies 14
Occasional Contributor

@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?

Reply
0 Upvotes
New Member

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

Reply
0 Upvotes
New Member

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

Reply
0 Upvotes
Occasional Contributor

@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.

New Member

@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

Reply
0 Upvotes
Occasional Contributor

@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.

Reply
0 Upvotes
New Member

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.

New Member

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

Reply
0 Upvotes
Occasional Contributor

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

Reply
0 Upvotes
New Member

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

Reply
0 Upvotes
New Member

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

Reply
0 Upvotes
Occasional Contributor

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

New Member

how could you share the code please

Reply
0 Upvotes
Highlighted
Occasional Contributor

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.

Reply
0 Upvotes