Sub topic 1
Why an integration needs its own user
Every call an integration makes to Salesforce runs as some user. That user's permissions decide what the call can read and change, and its name appears in audit data. This chapter explains why that user should be a dedicated account made for the integration, not a person's login. The later chapters build one.
Prerequisites
This chapter assumes you already know the following:
- Basic Salesforce administration: users, profiles, objects, fields.
- The Salesforce REST API and SOQL at a working level.
- The idea of OAuth 2.0 (access tokens, scopes, and flows), but not the details of any one flow.
- Access to a sandbox or Developer Edition org where you have admin rights. Do not practice on production.
What "the integration user" means
An integration is a system that talks to Salesforce without a person at the keyboard. Examples are a middleware platform that syncs accounts to an ERP, a nightly data warehouse export, and a web app that creates leads. Each of these needs an identity in Salesforce.
Salesforce has no separate "service account" object. Every API request is authenticated as a User record, and the record is checked against profiles, permission sets, field-level security, and sharing rules in the same way as for a human. The integration user is an ordinary user record that you set up for machine use.
The common shortcut is to reuse an existing human account. Someone with System Administrator rights enters their username and password into the middleware, and the connection works. This is the pattern the chapter argues against.
Problems with a shared human account
Permissions grow beyond what the integration needs
A human admin has broad rights: View All Data, Modify All Data, often Author Apex, and access to every object. If the integration runs as that person, a bug, a leaked token, or a misconfigured mapping can do everything the admin can do. A job that only needs to read Accounts can end up able to delete Opportunities or export Contacts.
The audit trail becomes ambiguous
Salesforce records who created or changed a record in system fields such as CreatedById and LastModifiedById. If the integration runs as Maria, every integration write shows Maria as the editor. You cannot tell later whether Maria changed a field or her sync job did. The same problem affects field history, login history, and event monitoring. Querying recent changes shows it:
SELECT Id, Name, LastModifiedBy.Name, LastModifiedDate
FROM Account
WHERE LastModifiedDate = LAST_N_DAYS:7
ORDER BY LastModifiedDate DESC
LIMIT 20With a dedicated user, a row whose LastModifiedBy.Name is the integration user came from the integration. With a shared account, the same row proves nothing.
The integration breaks when people change roles
Human accounts have a lifecycle that does not match the integration's. When Maria leaves, her account is deactivated, and the integration stops working. When she changes teams, her profile and role change and the integration's access changes with them. When her password expires or is reset, the stored credential becomes invalid. Each of these is a production outage that has nothing to do with the integration itself.
Authentication controls built for people get in the way
Human logins are protected by password policies, multi-factor authentication (MFA) prompts for interactive logins, and session timeouts. These controls do not suit unattended systems. Teams often respond by weakening the policy for the shared user, such as relaxing the password expiry or widening the login IP range. That weakens a real person's account to accommodate a machine.
A dedicated user lets you pick authentication that fits a machine, such as OAuth with a certificate-based flow. It also lets you leave the human policies untouched.
Credential exposure has a large blast radius
A password stored in a middleware tool, a config file, or a CI variable is a copy of a person's identity. If it leaks, you must treat the person's account as compromised, change their password, and reconnect every system that used it. If a dedicated user's credential leaks, you revoke or rotate one credential, and the attacker only had what that user could do.
The comparison
The diagram shows the two setups side by side.
The right-hand side shows a second point. Dedicated does not have to mean one user for the whole org. One integration user per integration is better still, because each can have its own permissions, its own audit trail, and its own revocation.
What a dedicated integration user gives you
| Concern | Shared human account | Dedicated integration user |
|---|---|---|
| Permissions | Whatever the person has | Only what the integration needs |
| Audit trail | Person and integration look the same | Integration changes are identifiable |
| Personnel changes | Offboarding breaks the integration | Independent of any employee |
| Authentication | Password and interactive controls | Token or certificate based, no prompts |
| Credential leak | Person's account is exposed | One scoped credential is revoked |
| Access review | Mixed with the person's job duties | One clear list of grants |
What it does not do
A dedicated user is the starting point, not the whole control. Three limits matter.
- A new user is not a safe user. If you clone the System Administrator profile for the integration, you have the same over-privilege under a different name. The permission work in later chapters is what makes the user least-privilege.
- It does not isolate API consumption. Salesforce API request limits are counted at the org level, not per user. A dedicated user lets you attribute usage to one integration, but it does not give that integration its own quota.
- It does not remove the need for licenses. An integration user is a real user and consumes a user license. Salesforce offers license types intended for API-only use, which a later chapter covers. In some orgs the choice of license affects cost.
Naming and ownership
Treat the user as infrastructure that someone owns. A few conventions save trouble later:
- Use a name that shows purpose and system, such as
[email protected]. In sandboxes, Salesforce appends the sandbox name to usernames on refresh. - Use a monitored shared mailbox for the user's email address, not a person's inbox. Salesforce sends password and verification emails to this address.
- Record in your documentation which system uses the user, who owns it, and which permission sets it holds. The access review chapter depends on this record.
- Keep one user per integration. Sharing one user between two systems recreates the audit problem on a smaller scale.
Where this leads
The rest of the tutorial builds the user in order. You first work out exactly what the integration needs, then choose a license and a minimal profile. Next you grant object, field, and API access with permission sets, and check how sharing limits record visibility. After that you authenticate with OAuth, restrict where the user can log in from, and verify the result. Monitoring and rotation come last. At each step the question is the same: what is the least this user needs in order to do its job?
Exercise
A middleware tool syncs Accounts to an ERP. It currently logs in as a Salesforce admin named Maria. Give two reasons from this chapter for moving it to a dedicated integration user, and say what a dedicated user will not fix by itself.
Show answer
First, the audit trail. Every sync write shows Maria as LastModifiedBy, so you cannot separate her edits from the sync's. A dedicated user makes integration changes identifiable. Second, availability. If Maria leaves, changes roles, or resets her password, the sync breaks. A dedicated user is independent of any employee. A further valid reason is the blast radius: a leaked credential exposes the full admin rights instead of a scoped set. A dedicated user does not fix over-privilege by itself. If the new user is given the System Administrator profile, it can still do everything an admin can. Its permissions must also be limited with a minimal profile and permission sets. It also does not give the integration its own API request quota, because those limits apply to the whole org.
Exercise
You find an active user named sync.user whose profile is System Administrator and whose last login came through the API. Which of the chapter's concerns apply, and what is a safe way to replace it?
Show answer
The user is dedicated, which helps with audit and personnel changes, but it is over-privileged, so the least-privilege goal is not met. To replace it safely, document what the integration actually needs, build a new user with a minimal profile and permission sets in a sandbox, and test the integration against it. Then switch the production credential in a planned window and deactivate the old user after confirming that nothing else depends on it. Warn people who filter reports or automation on CreatedById or LastModifiedById, because new writes will show the new user.