APIs & Integrations

DIntegration4
Member

fivetran auth to hubspot... refresh_token? bad client secret?

SOLVE
I am automating integration of fivetran to hubspot. I would rather not use the fivetran connect card and manually reconfigure regularly. To authenticate hubspot to fivetran I need: client_id, client_secret, and refresh_token.

I think I found the client_id in an auth url. It's a guid. It sure would be nice if hubspot made this easier to find.

The client secret comes from a private app I created in Integrations.

Ok, so the refresh token... the access key from the private app is not it.

I thought I might find the refresh token from the python hubspot library, with python 3.11.

with that, I pass the access token from the private app to create the client and make the tokens_api request and it should return a refresh token from some of the doc i saw.

```
from hubspot import HubSpot

api_client = HubSpot(access_token=access_token)

oauth_tokens = api_client.auth.oauth.tokens_api.create(
grant_type="authorization_code",
redirect_uri="http://localhost",
client_id=client_id,
client_secret=client_secret,
# code="code",
)
```

other than the "code", what is that?  it matches the example https://github.com/HubSpot/hubspot-api-python/tree/7544f674d66b20c293f79af7858f431c98a56277

but no token is returned, instead hubspot errors that "status":"BAD_CLIENT_SECRET","message":"missing or invalid client secret",

was this supposed to be encoded or something? i've checked the string matches a few times.  its the client secret for my private app.

i have super admin permissions.

is there an easier way?  suggestions on what i am doing wrong here? TIA!
0 Upvotes
1 Accepted solution
DIntegration4
Solution
Member

fivetran auth to hubspot... refresh_token? bad client secret?

SOLVE

I recently found this feature request on fivetran support portal

https://support.fivetran.com/hc/en-us/community/posts/17472730420503-Connector-Improvement-Authorizi...

which says this if you cant read it

 

Fivetran does not support the private app flow. Currently the only options to authenticate the connector through the API are:

  • Via the a connect card
  • Creating your own public app within Hubspot and then supplying those Oauth credentials (client_id, client_secret and refresh_token) to Fivetran.

It was recommened by the Hubspot support team that we should use the private app flow for this which is:
https://developers.hubspot.com/docs/api/private-apps#make-api-calls-with-your-app-s-access-token





so i guess it is a known problem.  thanks @Jaycee_Lewis for the public app hint!

View solution in original post

0 Upvotes
3 Replies 3
Jaycee_Lewis
Community Manager
Community Manager

fivetran auth to hubspot... refresh_token? bad client secret?

SOLVE

Hey, @DIntegration4 👋 Can you share the guide you are following, please? I ask because I've seen cases where some integrations or connectors require a public app using OAuth and some that have updated to allow for Private Apps. This can also help our community members to give you additional insight as well.

 

Thanks! — Jaycee

linkedin

Jaycee Lewis

Developer Community Manager

Community | HubSpot

0 Upvotes
DIntegration4
Member

fivetran auth to hubspot... refresh_token? bad client secret?

SOLVE

@Jaycee_Lewis this is the connector configuration guide from fivetran:

https://fivetran.com/docs/rest-api/connectors/config#hubspot

0 Upvotes
DIntegration4
Solution
Member

fivetran auth to hubspot... refresh_token? bad client secret?

SOLVE

I recently found this feature request on fivetran support portal

https://support.fivetran.com/hc/en-us/community/posts/17472730420503-Connector-Improvement-Authorizi...

which says this if you cant read it

 

Fivetran does not support the private app flow. Currently the only options to authenticate the connector through the API are:

  • Via the a connect card
  • Creating your own public app within Hubspot and then supplying those Oauth credentials (client_id, client_secret and refresh_token) to Fivetran.

It was recommened by the Hubspot support team that we should use the private app flow for this which is:
https://developers.hubspot.com/docs/api/private-apps#make-api-calls-with-your-app-s-access-token





so i guess it is a known problem.  thanks @Jaycee_Lewis for the public app hint!

0 Upvotes