HTTPError 400 Client Error: Bad Request when refreshing access token

Summary

The error occurs when trying to refresh the access token for OAuth authentication in the Airbyte connector. The request to refresh the access token to https://api.hubapi.com/oauth/v1/token resulted in a 400 Client Error: Bad Request.


Question


    prep = self.prepare_request(req)
  File "/usr/local/lib/python3.9/site-packages/requests/sessions.py", line 486, in prepare_request
    p.prepare(
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 372, in prepare
    self.prepare_auth(auth, url)
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 603, in prepare_auth
    r = auth(self)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 51, in __call__
    request.headers.update(self.get_auth_header())
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 56, in get_auth_header
    return {"Authorization": f"Bearer {self.get_access_token()}"}
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 61, in get_access_token
    token, expires_in = self.refresh_access_token()
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 150, in refresh_access_token
    response_json = self._get_refresh_access_token_response()
  File "/usr/local/lib/python3.9/site-packages/backoff/_sync.py", line 105, in retry
    ret = target(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py", line 132, in _get_refresh_access_token_response
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: <https://api.hubapi.com/oauth/v1/token>

HS Permissions:
crm.schemas.quotes.read
crm.objects.line_items.read
content
crm.schemas.deals.read
crm.schemas.line_items.read
automation
actions
crm.objects.subscriptions.read
crm.schemas.subscriptions.read
business-intelligence
crm.schemas.commercepayments.read
oauth
crm.objects.owners.read
crm.objects.commercepayments.read
forms
crm.objects.invoices.read
crm.schemas.invoices.read
crm.export
crm.objects.users.read
tickets
e-commerce
crm.objects.marketing_events.read
crm.schemas.custom.read
crm.objects.custom.read
crm.objects.feedback_submissions.read
sales-email-read
crm.objects.goals.read
crm.objects.companies.read
crm.lists.read
crm.objects.deals.read
crm.schemas.contacts.read
crm.objects.contacts.read
crm.schemas.companies.read
crm.objects.quotes.read```

<br>

---

This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C021JANJ6TY/p1712678792318649) if you want to access the original thread.

[Join the conversation on Slack](https://slack.airbyte.com)

<sub>
["httperror", "bad-request", "refresh-access-token", "oauth-authentication", "airbyte-connector"]
</sub>