Build Flows

Integrations · November 14, 2026 · 15 min read

Client Credentials vs Authorization Code: How Procore, HubSpot and QuickBooks Authenticate

Procore, HubSpot and QuickBooks Online each authenticate differently. This guide explains client credentials, static bearer tokens and authorization code with refresh tokens, with animated sequence diagrams, a what-breaks-when table and the Key Vault secrets each model needs.

By Charley Forey, founder of Build Flows

Key takeaways

  • Procore service accounts use OAuth client credentials: the pipeline trades the client ID and secret for a 1.5-hour access token whenever it needs one, with no person involved.
  • A HubSpot service key is a static bearer token. Nothing expires on a timer; the risk is rotating the key in HubSpot without updating Key Vault the same day.
  • QuickBooks Online uses authorization code plus refresh token: an admin approves once, then each refresh returns a 60-minute access token and a refresh token you must save back.
  • QuickBooks is why the integration needs Key Vault Secrets Officer, not read-only access: it writes the newest refresh token to the vault on every refresh.
  • A 401 usually means the credential is wrong or expired; a 403 usually means it works but lacks permission or scope.
  • Store long-lived secrets in Key Vault and fetch short-lived access tokens at run time instead of storing them.

You set up read-only API access for Procore, HubSpot and QuickBooks Online, and you put every secret in Azure Key Vault. Three months later one connection stops working and the other two keep running. Nobody changed anything. Or so it seems.

The reason is usually that the three systems don't authenticate the same way. Procore hands out a fresh token every time the pipeline asks. HubSpot gives you one key that works until someone rotates it. QuickBooks Online needs a person to approve the connection once, and after that it keeps itself alive by trading one refresh token for the next. Each model fails in its own way, at its own time, for its own reasons.

This guide explains the three models in plain English, shows each one as a sequence diagram, and lists what breaks when. It's the background to the full four-step credential setup. You don't need to be a developer to follow it, but your IT lead and whoever runs the integration should both read it.

The short version

SystemAuth modelWhat you store in Key VaultWho has to actShort-lived tokenWhat usually breaks it
ProcoreOAuth 2.0 client credentials, using a Developer Managed Service Account (DMSA)Client ID, client secret, company IDNobody, after installAccess token, 5,400 seconds (1.5 hours)Client secret regenerated, app uninstalled, permissions changed
HubSpotStatic bearer token (a service key)The key itselfNobody, until rotationNone. The key is the credentialKey rotated or revoked and Key Vault not updated
QuickBooks OnlineOAuth 2.0 authorization code + refresh tokenClient ID, client secret, realm ID, refresh tokenA QuickBooks admin clicks Connect onceAccess token, 60 minutesRefresh token not saved back, unused too long, revoked, or app disconnected

If you only remember one row, remember the last one. QuickBooks is the only system here where the integration has to write to Key Vault on its own, every time it refreshes.

Cover diagram showing three source systems on the left with their auth models: Procore uses client credentials with a token every 1.5 hours, HubSpot uses a static service key that stays the same until rotated, and QuickBooks Online uses an authorization code plus refresh token with one admin click. Animated lines run from each system into Azure Key Vault, then on to the Microsoft Fabric pipeline.Three systems, three auth models, one vault.

Three auth models in plain English

Client credentials: the app logs in as itself

OAuth 2.0 defines several "grant types", which are ways for an app to get an access token. The client credentials grant is the simplest. The app sends its own client ID and client secret to the login server and gets back a short-lived access token. No person signs in, and nobody clicks Approve. The OAuth standard describes it for exactly this case: an app acting on its own behalf, not on behalf of a user.

Procore's version of this is the Developer Managed Service Account. You create an app in the Procore Developer Portal, add the service account component, set what each tool can see (None, Read Only, Standard or Admin), and a company admin installs the app in Company Settings → App Management. From then on, the app's client ID and secret are enough to get a token. The Procore service account guide walks through the clicks.

Think of it like a badge reader. The badge (client ID and secret) doesn't open doors by itself. Each time you swipe it, you get a day pass (the access token), and the day pass expires.

Static bearer token: the key is the credential

A bearer token is any token where holding it is enough. You put it in the Authorization: Bearer ... header and the API trusts whoever sent it. With a static token there's no exchange step at all. The same value works every time until someone rotates or revokes it.

HubSpot's service keys work this way. A super admin (or a user with Developer tools access) creates the key, picks scopes such as crm.objects.deals.read, and copies the value. HubSpot's docs show it sent as a plain bearer token. Older setups used a private app access token (it starts with pat-), which is sent the same way. If your vault already has a secret called hubspot-private-app-token, you can keep the name and store the service key in it. See HubSpot service key setup.

This is a house key. Simple, and it works until you change the locks. Whoever holds a copy can get in, which is why it belongs in Key Vault and nowhere else.

Authorization code + refresh token: a person says yes once

The authorization code grant exists for when the data belongs to someone who has to agree to share it. A person is sent to the provider's sign-in page, approves access, and the provider redirects back with a one-time code. The app exchanges that code for two tokens: a short-lived access token and a longer-lived refresh token. When the access token expires, the app trades the refresh token for a new pair. No person is needed again unless the refresh token stops working.

QuickBooks Online uses this model. That's why the setup has a step where "an admin clicks Connect once". Your QuickBooks admin signs in to Intuit, picks the company, and approves accounting access. Intuit sends back the code and the realm ID, which is the company's ID in QuickBooks. After that the connection runs on its own. The QuickBooks credentials guide covers creating the Intuit app.

This is a valet ticket. The owner hands over the car once. After that, each ticket is swapped for a new one every time the car moves, and you must keep the newest ticket.

Why each system is different

It isn't arbitrary. Each vendor picked the model that fits who owns the data and how apps are installed.

  • Procore has both models. Apps that act for a signed-in user use the authorization code grant (the "User Level Authentication" component in the Developer Portal). Company-wide, unattended integrations use the DMSA with client credentials. A reporting pipeline is unattended, so the service account is the right fit.
  • HubSpot introduced service keys as the replacement for legacy private apps in system-to-system integrations. A service key is tied to one HubSpot account and is meant for exactly this kind of data integration. HubSpot's docs note limits: service keys are for REST API calls, not webhooks or UI extensions.
  • Intuit built QuickBooks Online access around the person who owns the books. As far as Intuit's public docs show, there is no service-account grant for a company's accounting data. A person with access to the company has to authorize the app, and the app then keeps the connection alive with refresh tokens.

Procore: client credentials, step by step

Sequence diagram with four participants: the Fabric pipeline, Azure Key Vault, the Procore login server and the Procore API. Step 1, the pipeline reads procore-client-id and procore-client-secret from Key Vault. Step 2, it posts them to the Procore oauth token endpoint with grant_type client_credentials. Step 3, Procore returns an access token with expires_in 5400, which is 1.5 hours, and no refresh token is needed. Step 4, the pipeline calls the Procore API with the bearer token and the Procore-Company-Id header. Step 5, Procore returns read-only project data scoped to what the service account was granted. Step 6, when the token expires, go back to step 2.Procore: the pipeline trades the client ID and secret for a 1.5-hour token, every time it needs one.

  1. The pipeline reads procore-client-id and procore-client-secret from Key Vault.
  2. It posts them to Procore's /oauth/token endpoint with grant_type=client_credentials.
  3. Procore returns an access token. Procore's documented example shows expires_in: 5400, which is 1.5 hours.
  4. The pipeline calls the API with Authorization: Bearer <token> and a Procore-Company-Id header, so Procore knows which company the request is for.
  5. Procore returns only what the service account's permissions allow.

What you store: the client ID, the client secret and the company ID (plus the base URL, https://api.procore.com). You don't need to store the access token. Getting a new one costs one request, so the simplest safe design is to request a token at the start of each run and request another if a call returns 401.

What breaks it: someone regenerates the client secret, the app is uninstalled from the company, or the service account loses access to a tool or project. Token expiry on its own is never a real outage, because the pipeline just asks again.

HubSpot: a static key, step by step

Sequence diagram with three participants: the Fabric pipeline, Azure Key Vault and the HubSpot API. Step 1, the pipeline reads the service key from Key Vault. Step 2, it calls the HubSpot CRM API with an Authorization Bearer header. Step 3, HubSpot returns CRM records limited to the read scopes on the key. When the key is rotated: step 4, an admin rotates the key in HubSpot, either expiring the old one now or keeping it for 7 days. Step 5, the new key is pasted into Key Vault as a new version of the same secret. Step 6, if that step is missed, the next run gets 401 Unauthorized once the old key expires.HubSpot: no exchange at all, so the only moving part is rotation.

  1. The pipeline reads the key from Key Vault.
  2. It calls the CRM API with Authorization: Bearer <key>.
  3. HubSpot returns records, limited to the scopes on the key.

There's no token endpoint and nothing expires on a timer by default. The moving part is rotation. HubSpot's docs describe three options:

Rotation optionWhat happens to the old keyWhen to use it
Rotate and expire nowRevoked immediatelyThe key may have leaked
Rotate and expire laterKeeps working for 7 daysPlanned rotation, so you have time to update Key Vault
Automatic rotationRotates every 3, 6 or 12 months; super admins and users with Developer tools access get an email when it rotates and before the old key expiresOngoing hygiene, if someone owns the Key Vault update

HubSpot recommends rotating every six months. Whichever option you pick, the rule is the same: the day you rotate in HubSpot is the day you add a new secret version in Key Vault. Use the same secret name so the pipeline picks up the new value without a code change. The rotation guide has the runbook.

QuickBooks Online: authorization code + refresh token, step by step

Sequence diagram with four participants: your QuickBooks admin in a browser, Intuit, Azure Key Vault and the connector, which hosts the callback and the Fabric pipeline. One time, on a call: step 1, the admin clicks Connect and signs in to Intuit. Step 2, the admin picks the company and approves accounting access. Step 3, Intuit redirects through the browser to the connector with a single-use authorization code and the realmId. Step 4, the connector exchanges the code for tokens. Step 5, it saves the refresh token and realm ID to Key Vault. Every run after that: step 6, the connector reads the refresh token. Step 7, it posts grant_type refresh_token to Intuit. Step 8, Intuit returns a new access token valid for 60 minutes and a refresh token. Step 9, the connector writes the latest refresh token back to Key Vault, which needs write access. Step 10, if the refresh token lapses, is revoked or the app is disconnected, the refresh fails with invalid_grant and an admin must click Connect again.QuickBooks: one admin approval, then the connector keeps the newest refresh token in Key Vault.

One time, on a call:

  1. Your QuickBooks admin clicks Connect and signs in to Intuit.
  2. They choose the company and approve accounting access.
  3. Intuit redirects back with a one-time authorization code and the realm ID.
  4. The connector exchanges the code for an access token and a refresh token.
  5. The refresh token and realm ID go into Key Vault as quickbooks-refresh-token and quickbooks-realm-id.

Every run after that:

  1. The connector reads the refresh token from Key Vault.
  2. It posts grant_type=refresh_token to Intuit's token endpoint.
  3. Intuit returns a new access token and a refresh token. Intuit's docs state access tokens are valid for 60 minutes.
  4. The connector writes the refresh token it just received back to Key Vault, as a new version of the same secret.

Step 4 is the one that bites. Intuit's authorization FAQ says the refresh token value can change when you use it, and that once you receive a new one, the previous value expires. Always store the latest one. Keep using an old value and the next refresh can fail with invalid_grant. That's why the setup asks for Key Vault Secrets Officer and not a read-only role: the integration has to update this one secret on its own. In a Fabric Python notebook, notebookutils.credentials.putSecret can do that write. Microsoft's docs note it works only in notebooks on the Python runtime, not in Spark notebooks. The Fabric notebook guide shows the read side.

How long does the refresh token last? Be careful with any single number here, including ones you find in older blog posts. Intuit's authorization FAQ says a refresh token expires if it goes unused for 100 days, and that all refresh tokens now have a maximum validity of five years. Intuit's announcement puts the first five-year expiries in 2027 or 2028, depending on the scopes and when the token was issued. The practical rules don't change:

  • Refresh at least every few days, even if you only report weekly, so the token never sits unused.
  • Read x_refresh_token_expires_in from each token response and log it, instead of hard-coding a lifetime.
  • Plan for the day an admin has to click Connect again, because sooner or later one will.

Only one process should refresh at a time. If two runs refresh in parallel, one of them can end up holding a token that's already been replaced. Schedule the QuickBooks refresh in one place.

What breaks when

EventProcore (client credentials)HubSpot (service key)QuickBooks (auth code + refresh)
Access token expiresNothing. Pipeline asks for a new oneNot applicableNothing, if the refresh works
Secret rotated at the vendorFails until Key Vault has the new client secretFails once the old key expires, unless Key Vault was updatedClient secret change fails the refresh until Key Vault is updated
Refresh token not saved backNot applicableNot applicableNext refresh can fail with invalid_grant
Integration idle for monthsFineFineRefresh token can lapse. Admin must reconnect
Person who set it up leavesFine. The service account isn't a personUsually fine. Check that another admin can rotate the keyCan break. If the admin who clicked Connect loses admin access or is removed from the company, refreshes can fail with invalid_grant. Have another admin ready to reconnect
Permissions or scopes reduced403 on the tools removed403 on the objects without scope403 or missing data
App uninstalled, disconnected or key deletedEvery call failsEvery call fails with 401Refresh fails, admin must reconnect

The useful pattern: a 401 usually means the credential itself is wrong or expired, and a 403 usually means the credential works but doesn't have permission. The troubleshooting guide goes through each error by system.

How Key Vault fits

Key Vault holds the long-lived parts. It doesn't need to hold the short-lived access tokens, because the pipeline can get those on demand.

Secret nameModelWho writes itHow often it changes
procore-client-idClient credentialsYou, at setupRarely
procore-client-secretClient credentialsYou, at setup and on rotationWhen regenerated
procore-company-idClient credentialsYou, at setupNever
procore-base-urlClient credentialsYou, at setupNever
hubspot-private-app-token (holds the service key)Static tokenYou, at setup and on rotationEvery rotation
quickbooks-client-id, quickbooks-client-secretAuth codeYou, at setupRarely
quickbooks-realm-idAuth codeConnector, at ConnectNever
quickbooks-environmentAuth codeYou, at setupNever
quickbooks-refresh-tokenAuth codeConnector, on every refreshCan change every refresh

A few rules that follow from the models:

  • Read at run time, never copy. Fabric reads secrets by vault URL and name, using the identity running the notebook. Microsoft's docs say to never hard-code secrets in notebook code. See Fabric and Key Vault.
  • Give write access only where it's needed. Secrets Officer can read and write secrets. Secrets User can only read them. The QuickBooks refresh is the reason the integration identity needs Officer. Key Vault setup covers the role assignment.
  • Use expiration dates as reminders. If you set an expiration date on the HubSpot key secret to match your rotation schedule, Key Vault raises a SecretNearExpiry event 30 days before that date. The expiry alerts guide wires that up to an email.
  • Never send any of these by email. That includes the refresh token. The secure handoff guide explains why and what to do instead.

Checklist

  • Procore DMSA installed in Company Settings → App Management, with Read Only on the tools the reports need
  • procore-client-id, procore-client-secret, procore-company-id and procore-base-url in Key Vault
  • HubSpot service key created with read-only scopes and stored in Key Vault
  • HubSpot rotation schedule chosen, with a named person who updates Key Vault the same day
  • Intuit app created, with QuickBooks client ID and secret in Key Vault
  • QuickBooks admin booked for the one-time Connect click
  • Integration identity has Key Vault Secrets Officer on this vault only, so it can save new refresh tokens
  • QuickBooks refresh runs from one scheduled job, at least every few days
  • x_refresh_token_expires_in logged on each refresh
  • Alerts on 401 responses for each system, plus Key Vault expiry events where you set dates
  • A written note of who can click Connect again if QuickBooks has to be reauthorized

Use the API credential setup checklist to track the whole setup, and the read-only scope picker to choose scopes.

Need a hand?

Build Flows sets up these connections for contractors who report in Microsoft Fabric: the service account, the scopes, the vault and the refresh job that keeps QuickBooks alive. If you want a second pair of eyes on your setup, email charley@buildflows.ai or visit buildflows.ai.

References

Frequently asked questions

What is the difference between OAuth client credentials and authorization code?

Client credentials lets an app get a token with its own client ID and secret, with no person signing in. Authorization code sends a person to sign in and approve access once, then the app uses a refresh token to stay connected.

How long does a Procore access token last?

Procore documents an expires_in of 5400 seconds, or 1.5 hours, for tokens from the client credentials grant. A service account integration simply requests a new token when the old one expires, so no refresh token is needed.

Do HubSpot service keys expire?

HubSpot does not document a default lifetime. A key stops working when it is rotated or revoked. You can rotate and expire the old key now, keep it working for 7 days, or set automatic rotation every 3, 6 or 12 months.

How long do QuickBooks Online tokens last?

Intuit says access tokens are valid for 60 minutes. A refresh token expires if it goes unused for 100 days, and Intuit now caps every refresh token at five years. Log x_refresh_token_expires_in from each response rather than hard-coding a lifetime.

Why does QuickBooks need an admin to click Connect?

QuickBooks Online uses the OAuth authorization code flow, so a person with access to the company must sign in to Intuit and approve the app once. After that the integration keeps the connection alive with refresh tokens.

Why does the integration need Key Vault Secrets Officer instead of read access?

The QuickBooks refresh token can change every time it is used, so the integration must write the newest value back to Key Vault. Secrets User can only read secrets; Secrets Officer can also set them.

Should I store access tokens in Azure Key Vault?

Usually not. Access tokens last an hour or two and can be fetched at run time. Store the long-lived parts in Key Vault: client IDs and secrets, the HubSpot key, IDs such as the realm ID, and the QuickBooks refresh token.

Next step

Need this connection in your environment?

Scope one integration: the records, direction, timing, and business rules behind the connection.

Prefer email? charley@buildflows.ai

Keep learning