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

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 GitHub - HubSpot/hubspot-api-python at 7544f674d66b20c293f79af7858f431c98a56277 · GitHub

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!

Hey, @DIntegration4 :waving_hand: 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

@Jaycee_Lewis this is the connector configuration guide from fivetran:

I recently found this feature request on fivetran support portal
https://support.fivetran.com/hc/en-us/community/posts/17472730420503-Connector-Improvement-Authorizing-HubSpot-Connector-WIth-Private-App-Access-Token
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:
Legacy private apps - HubSpot docs


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