Hey community!
I’m creating my second HubSpot App since I want to have 2 separated environment - test and prod.
(first HubSpot app just works fine - but I’m not able to do refresh the OAuth2 token with the 2nd App).
Here’s how I do it:
1) Created a HubSpot app (https://developer.hubspot.com/)
2) Defined redirect URL in auth settings
For example: http://locahost
3) Installed your app with URL (through Browser)
> Within browser, selected which account the App should be installed to
4) Retrieved the authorization code from URL
5) Requested access token
curl -i -X POST \
‘https://api.hubapi.com/oauth/v1/token’ \
-d ‘grant_type=authorization_code’ \
-d ‘client_id={client_id}’ \
-d ‘client_secret={client_secret}’ \
-d ‘redirect_uri={redirect_uri}’ \
-d ‘code={code}’
Response:
{
“token_type”:“bearer”,
“refresh_token”:“{refresh_token}”,
“access_token”:“{access_token}”,
“expires_in”:1800
}
6) Used the refresh token to generate a new access token (after expiring)
curl -i -X POST \
‘https://api.hubapi.com/oauth/v1/token’ \
-H ‘Content-Type: application/x-www-form-urlencoded’ \
-d ‘grant_type=refresh_token’ \
-d ‘client_id={client_id}’ \
-d ‘client_secret={client_secret}’ \
-d ‘redirect_uri={redirect_uri}’ \
-d 'refresh_token={refresh_token}'
This is the response I got back:
{
“status”: “BAD_CLIENT_SECRET”,
“message”: “missing or invalid client secret”,
“correlationId”: “63663eed-c495-4027-9714-22b511f56be5”
}
Any clue of what I might do doing wrong here?
(as I said for the 1st App it just works fine for me when refreshing the token)