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!