Open the login history of an org where every integration signs in as the same administrator, and it reads like the diary of one tireless employee. She logs in four hundred times a day, from five IP addresses, and never sleeps.
That account usually has a stored password, a security token glued to the end of it, and modify-all-data. People in the org got single sign-on and then MFA. The MFA requirement covers UI logins, so the integration account kept its password and nobody had a reason to look at it again.
There are two separate repairs here, and I think most teams spend their effort on the smaller one, the OAuth flow. The larger one is who the token acts as.
Two flows that work without a person
A server-to-server integration has no browser and nobody to click Allow. In Salesforce that leaves two flows I’d use for new work: client credentials and JWT bearer. Both return an access token and no refresh token. When the token expires, the service asks for a new one.
With client credentials, the service posts a consumer key and a consumer secret to the org’s token endpoint. The run-as user isn’t in the request at all. An admin picks it on the app definition, so the caller can’t ask to be someone else.
With JWT bearer, the service signs a short-lived assertion with a private key and names the user it wants to be. Salesforce checks the signature against a certificate uploaded to the app, and checks that the user was pre-approved for that app. The private key never leaves your side.
So the choice comes down to where the secret lives and who rotates it.
| Flow | Secret | Rotation | Use when | Avoid when |
|---|---|---|---|---|
| Client credentials | Consumer key and secret, known to both sides | Generate a new secret on the app, update the store, retire the old one. Short cycle, 90 days is reasonable | The caller is a vendor tool or iPaaS that only accepts an ID and a secret, or the team has no way to hold a private key | The secret would end up in a config file, a CI variable anyone can read, or a vendor’s settings page you can’t audit |
| JWT bearer | Private key on your side, certificate on the app | Issue a new key pair, upload the certificate, swap the key in a planned window. Yearly is common | You run the code and have a KMS or vault that can sign without exporting the key | The caller can’t sign a JWT, or nobody will own certificate expiry |
My default is JWT bearer for anything we build ourselves and client credentials for anything we buy. A shared secret can be copied out of a log line. A private key that only a KMS can use can’t.
The app definition can be a connected app or one of the newer external client apps. The flow settings are the same ideas in both. Keep one app per integration, so a secret can be revoked without taking five other systems down with it.
The user is the bigger problem
Suppose you do all of that and the run-as user is still an administrator. A stolen secret now does exactly the damage the stolen password did. The flow decides how hard the credential is to steal. The user decides what it’s worth once it’s gone.
So every integration gets its own user. Salesforce has an integration user licence for this: API only, no UI login, and a minimal profile that grants almost nothing. Access comes from a permission set you write, object by object and field by field.
I want a manifest in the repo that says what the integration is allowed to do, reviewed like any other change. Somebody adding a fifth object should have to open a pull request and explain why.
Here’s one for an ERP sync:
integration: erp-sync
owner: finance-systems
app:
name: ERP_Sync
flow: client_credentials
scopes: [api]
secret_rotation_days: 90
run_as:
username: [email protected]
licence: Salesforce Integration
api_only: true
permission_set: ERP_Sync_Access
network:
allowed_ip_ranges:
- start: 203.0.113.16
end: 203.0.113.31
system_permissions:
ApiEnabled: true
ModifyAllData: false
ViewAllData: false
objects:
Account:
access: [read, update]
fields:
read: [Name, AccountNumber, BillingStreet, BillingCity, BillingState, BillingPostalCode, BillingCountry]
edit: [ERP_Customer_Id__c, Credit_Hold__c]
Order:
access: [read, update]
fields:
read: [OrderNumber, AccountId, EffectiveDate, TotalAmount, CurrencyIsoCode]
edit: [Status, ERP_Order_Id__c, Shipped_Date__c, Carrier__c, Tracking_Number__c]
OrderItem:
access: [read, update]
fields:
read: [OrderId, Product2Id, Quantity, UnitPrice]
edit: [ERP_Line_Id__c, Shipped_Quantity__c, Backordered__c]
Product2:
access: [create, read, update]
fields:
edit: [Name, ProductCode, IsActive, QuantityUnitOfMeasure, ERP_Item_Id__c]
The format is my own. A small script can compare it to the permission set metadata in source control and fail the build when they drift.
Notice that delete appears nowhere. If the ERP needs to remove a product, it sets IsActive to false.
Six integrations off one administrator
Wrenfield Logistics is invented. It has six integrations: an ERP sync, a marketing platform, a data warehouse loader, a support desk, an e-signature tool, and a nightly finance export. All six sign in as one administrator account with a stored password.
The migration goes one integration at a time, in three steps each.
First, log what the integration’s own client reads and writes for a couple of weeks. For the ERP sync that comes to 4 objects and 31 fields, which is the manifest above.
Second, create the API-only user, the permission set, and the app. The three integrations Wrenfield builds itself move to JWT bearer with certificates on a yearly rotation. The three vendor tools take client credentials with secrets rotated every 90 days.
Third, cut over and watch for permission errors for a week. When the sixth one is done, the shared administrator is deactivated.
The ERP sync goes from modify-all-data to read and write on those 4 objects. If its secret leaks, the attacker gets orders and billing addresses. That’s still an incident. It’s a far smaller one than losing the whole org.
The side effect I like best is in the login history. Each row now carries a username and an app name that mean something. When a burst of logins shows up at 2 a.m., the first question has an answer: it was the warehouse loader, from its usual address range, rerunning a batch. The same names make it possible to give each integration its own share of the API limit.
The cost of six of everything
Six users and six rotation dates are more to look after than one password. The manifest is my answer to that: the inventory is a folder of small files, and each rotation date goes on a calendar a team owns.
Discovery is the harder part, because nobody knows what the old integrations touch and trimming access feels risky. Start with the widest permission set the logs justify, ship it, and tighten after a month of clean runs. An over-scoped integration under its own name still beats an administrator nobody can attribute.