airbytehq / airbytehq/airbyte

HubSpot OAuth via initiateOAuth API fails with scope mismatch

オープン
#75,517 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
autoteam community team/use
主要言語
Python
スター
22.1k
フォーク
5.3k
PR マージ指標
PR 指標を取得中

説明

## Summary

The HubSpot OAuth connector fails with a scope mismatch error **both via the `initiateOAuth` API AND the Airbyte Cloud dashboard UI**. This is NOT an API-only issue — it affects all HubSpot OAuth flows.

## Related Issues

- #75516 (Snapchat/Pinterest redirect_uri mismatch — API-only issue, different root cause)
- #57001 (HubSpot Programmatic Config Flow Fails)

## Error

```
Couldn't complete the connection
Authorization failed because there is a mismatch between the scopes in the
install URL and the app's configured scopes. Please contact the app developer.
```

## Consent URL (same error from BOTH dashboard and API)

**From Airbyte Cloud Dashboard UI:**
```
https://app.hubspot.com/oauth/47978882/authorize
?client_id=3d4b67a7-9cfa-4893-a622-c6a48fc50647
&redirect_uri=https://cloud.airbyte.com/auth_flow
&state=mrGVUyU
&scopes=crm.schemas.contacts.read%2Bcrm.objects.contacts.read
&optional_scopes=content+automation+e-commerce+files+...
```
Result: **Same scope mismatch error**

**From initiateOAuth API:**
```
https://app.hubspot.com/oauth/47978882/authorize
?client_id=3d4b67a7-9cfa-4893-a622-c6a48fc50647
&redirect_uri=https://api.airbyte.com/v1/oauth/callback
&state=UpEenbZ
&scopes=crm.schemas.contacts.read%2Bcrm.objects.contacts.read
&optional_scopes=content+automation+e-commerce+files+...
```
Result: **Same scope mismatch error**

## Likely Root Cause

The scopes requested in the consent URL do not match the scopes configured in Airbyte's HubSpot OAuth app (client_id=3d4b67a7-9cfa-4893-a622-c6a48fc50647).

Additionally, the `scopes` parameter uses `%2B` (literal plus) as separator between scope values:
```
scopes=crm.schemas.contacts.read%2Bcrm.objects.contacts.read
```
While `optional_scopes` uses `+` (space) as separator:
```
optional_scopes=content+automation+e-commerce+...
```
HubSpot may interpret `%2B` differently than `+`, causing an unexpected scope value that doesn't match the app's registered scopes.

## Steps to Reproduce

**Via Dashboard:**
1. Go to Airbyte Cloud → Sources → New Source → HubSpot
2. Select OAuth2.0 authorization method
3. Click "Authenticate your HubSpot account"
4. HubSpot shows scope mismatch error

**Via API:**
```bash
curl -X POST https://api.airbyte.com/v1/sources/initiateOAuth \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"redirectUrl": "https://myapp.com/callback",
"workspaceId": "YOUR_WORKSPACE_ID",
"sourceType": "hubspot",
"oAuthInputConfiguration": {}
}'
```
Open the returned consentUrl → same scope mismatch error.

## Environment

- Airbyte Cloud
- HubSpot connector
- Tested: March 2026

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。