The decision is one question
Does this integration talk to one HubSpot portal, or to portals belonging to people who are not you? If one, a private app is correct and OAuth adds a token-refresh subsystem you gain nothing from. If many, OAuth is the only correct answer, because each customer must be able to grant and revoke access to their own data independently.
The failure mode of getting this wrong in one direction is wasted work; in the other it is a security incident. Handing several customers the same private app token means they all hold a credential scoped to your portal, none of them can revoke it without breaking everyone, and a leak at any one of them compromises all of them.
Private app vs OAuth app
| Private app | OAuth (public) app |
|---|
| Serves | One portal you control | Any portal that installs it |
| Credential | pat-na1-… access token | access_token + refresh_token per portal |
| Token lifetime | Long-lived until revoked | access_token expires (expires_in seconds) |
| Refresh flow needed? | No | Yes — mandatory |
| Consent screen | None | Per installing portal |
| Short-window rate limit | 100 or 190 req / 10 sec by tier | 110 req / 10 sec per installing account |
| Daily cap | 250,000 / 625,000 / 1,000,000 by tier | No published daily cap |
| Scope changes | Edited in the app settings | Require re-consent from each portal |
What a private app request looks like
There is no handshake. You create the app in the portal, tick the scopes it needs, copy the token once into a secret store, and every request carries it in an Authorization header exactly as an OAuth access token would. Because the header format is identical, client code written for one works unchanged for the other — only the token acquisition differs.
curl https://api.hubapi.com/crm/v3/objects/contacts?limit=1 \
-H "Authorization: Bearer pat-na1-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
# Verify which portal and scopes a token actually carries:
curl https://api.hubapi.com/oauth/v1/access-tokens/pat-na1-xxxx...
# -> { "hub_id": 12345678,
# "scopes": ["crm.objects.contacts.read","crm.objects.contacts.write"],
# "token_type": "access" }
#
# Run this in a startup health check. It answers "is this the right
# portal, with the right scopes" in one request and no writes.
What the OAuth flow actually costs you to build
OAuth is three moving parts. First, an authorization URL that sends the portal admin to HubSpot with your client_id, the scopes you are requesting and a redirect_uri that must match the app configuration exactly. Second, a callback endpoint that receives a one-time code and exchanges it at /oauth/v1/token for an access token and a refresh token. Third — the part people underestimate — a refresh loop, because the access token expires and every stored portal connection needs its own refresh handled before the next scheduled job runs.
The refresh token is the durable credential and must be stored per portal, encrypted, alongside the hub_id it belongs to. A single shared token variable is the classic bug in a first OAuth build: it works with one test portal and starts overwriting credentials the moment a second customer installs.
# 1. Send the admin here
https://app.hubspot.com/oauth/authorize
?client_id=CLIENT_ID
&scope=crm.objects.contacts.read%20crm.objects.contacts.write
&redirect_uri=https%3A%2F%2Fexample.com%2Foauth%2Fhubspot%2Fcallback
&state=RANDOM_NONCE
# 2. Exchange the code (x-www-form-urlencoded, not JSON)
POST https://api.hubapi.com/oauth/v1/token
grant_type=authorization_code
&client_id=...&client_secret=...
&redirect_uri=https://example.com/oauth/hubspot/callback
&code=ONE_TIME_CODE
# -> { "access_token": "...", "refresh_token": "...", "expires_in": 1800 }
# 3. Refresh, per portal, before expiry
POST https://api.hubapi.com/oauth/v1/token
grant_type=refresh_token&client_id=...&client_secret=...
&refresh_token=STORED_REFRESH_TOKEN
Scopes behave differently in the two models
In a private app, adding a scope is an edit in the portal's app settings and takes effect on the next request. In an OAuth app, adding a scope to an already-installed application means every existing portal must re-consent before your calls with the new scope succeed — until they do, those portals return 403 MISSING_SCOPES while everything else keeps working. That asymmetry is worth designing for up front: request the scopes the roadmap needs at install time rather than adding them one feature at a time.
In both models a 403 with MISSING_SCOPES names the missing scope in the response body, and the fix is never in the HTTP client.
You cannot convert a private app into a public one. If there is any prospect of a second customer, the cost of building OAuth now is far below the cost of rebuilding the credential layer, the storage model and the refresh loop later.
The storage model is what makes the two irreversible
The visible difference between the two models is the handshake. The difference that makes a later migration expensive is what you have to store. A private app integration stores one secret, and every piece of code downstream can assume a single portal exists — the object ID in a mapping table needs no qualifier, a cached property map needs no key, and a scheduled job needs no notion of which customer it is running for.
An OAuth integration stores a row per installing portal: the hub_id, an encrypted refresh token, the current access token and its expiry, the scopes actually granted, and the install's status. Every cache and every mapping table must then be keyed on hub_id, and every scheduled job becomes a loop over installs with per-install failure handling — one portal revoking access must not stop the other forty from syncing.
That is why converting later is a rewrite rather than a swap. The credential layer is the small part; the assumption that there is exactly one portal is woven through the data model, the caches and the job scheduler. If a second customer is plausible within the life of the integration, build the per-portal storage shape from the start even while a single private app is the only credential in it.
- Store refresh tokens encrypted, one row per hub_id, never in a single shared variable.
- Key every cache and mapping table on hub_id from day one.
- Refresh proactively on a schedule, not reactively on the first 401.
- Handle a revoked install as a normal state, not an error that stops the batch.
- Record which scopes each portal actually granted — they can differ between installs.
Where these facts come from