Oauth2: HubSpot providing invalid auth code

Hello HubSpot Community,
I’m encountering an issue with the HubSpot API.
I’ve set up an OAuth app where users can sign in and grant permissions to my app.
Upon successful authentication, HubSpot sends a code to my backend, which I then exchange for a refresh token.
While this process has worked seamlessly for over 200 users, I’ve recently observed that some users, despite having the correct permissions, are unable to connect.
Upon inspecting my logs, I noticed an error associated with the /oauth/v1/token endpoint. This is where I attempt to exchange the received code from HubSpot for a refresh token. The error details are as follows:

"correlationId": "[ID was inserted here but hidden now]",
"message": "missing or unknown auth code",
"status": "BAD_AUTH_CODE"

I’ve searched the forum for insights but haven’t found a solution.
Has anyone experienced this or have any suggestions on how to resolve it?
Thank you in advance for your assistance!

Hi @Julien_hublead,
Thank you for reaching out to the Community!
I’d like to share these similar posts that might be of interest to you:
- OAuth “BAD_AUTH_CODE”
- “status”:“BAD_AUTH_CODE”,“message”:“missing or unknown auth code”
- New permission requirements for installing public apps
- “BAD Authorization Code” issue
I also wanted to invite a couple of subject matter experts to this conversation @deepikaverma, @miljkovicmisa and @ChrisoKlepke do you have suggestions to help @Julien_hublead, please?
If anybody else has anything to add and/or share, please feel free to join in the conversation :slightly_smiling_face:
Thanks and have a lovely day!
Best,
Bérangère