Agents at the Door
เนื้อหานี้ยังไม่มีในภาษาของคุณ
Module 2 of 6 in the chapter Agents and Identity, chapter 17 of Securing Salesforce: Identity and Access. Each module stands on its own.
The question this module answers: An agent outside Salesforce needs in. Which door does it use?
No new doors
Section titled “No new doors”Module 1’s agents lived inside Salesforce. They ran in Lightning, or in a chat window on a Salesforce site, and Salesforce knew who was signed in. But a lot of agents don’t live there. A company’s own mobile app has an agent behind its chat. A coding assistant on a developer’s laptop reads and changes records. A nightly agent in another cloud reconciles deliveries with a partner’s system. Each one has to get into Salesforce from outside.
Here’s the good news, and it’s the reason this chapter comes at the end of the course. There are no new doors. An agent signs in through the same OAuth flows you’ve already learned. What’s new is choosing the right one, because an agent can look like a person, a system, or both.
Salesforce’s architects make this the second zone of their threat model, between the app the agent lives in and Salesforce: “Does the host prove its own identity, and does it pass the end user’s identity through?” (S1). Two questions again. Who is the app? And who is it acting for?
Chapter 5’s question first
Section titled “Chapter 5’s question first”In chapter 5, every choice of door started with one question: who starts it? A person in a browser, a person through an app, no person at all, a device. Ask it again about the agent, and then ask module 1’s second question: who is the agent acting for?
Put those together and you get the table Salesforce’s own architects publish, in their guide to trust for agents (S1). I’ve added the chapter where each flow was taught.
| The connection | Salesforce’s recommendation (S1) | Taught in |
|---|---|---|
| A system connects to an agent, as itself | Client credentials flow, running as a dedicated integration user | Chapter 8 |
| A system connects, carrying a user’s context | OAuth 2.0 Token Exchange: the user’s existing identity provider token is exchanged for a Salesforce one, and “the user’s identity carries across the hop rather than collapsing to a shared account” | Chapter 11, module 4 |
| An internal user’s app with no browser | JWT bearer flow, “which maintains the specific user’s context” | Chapter 11, module 2 |
| An external customer or partner’s app with no Salesforce screen | Headless Identity Authorization Code and Credentials Flow, with PKCE | Chapter 15, module 3 |
| An external user talks to an agent | A dedicated, least-privilege agent user | Module 1 |
And one more row that Salesforce’s own MCP servers add, for an AI client where a person is there to approve: the authorization code flow with PKCE, the web server flow from chapter 9 (S5, S7). The person signs in, sees what the app is asking for, and says yes. Module 5 comes back to it.
As itself, or as someone
Section titled “As itself, or as someone”Look at the first two rows side by side, because that’s the decision that matters most.
An agent that signs in as itself gets one identity, its integration user, for every request. That’s right when the work isn’t anyone’s in particular: reconciling deliveries every night, checking stock, summarizing yesterday’s cases for a dashboard. Salesforce’s advice is to give it its own dedicated user, not to share one (S1). Chapter 8 called this the base pattern, and for work that belongs to nobody, it’s still the right one.
An agent that signs in as someone carries that person. Every read is limited by her access, and every change has her name on it. That’s right when the work is hers: her cases, her orders, her approvals.
The trap is using the first for the second. An agent in a customer app signs in with client credentials, gets one powerful identity, and then decides for itself which customer’s records to show. Now the agent’s judgment is the only thing between one customer and another. Salesforce’s architects name exactly this pitfall for the app-to-Salesforce zone: “Client-credential tokens exposed in the browser, since they represent one shared service identity” (S1). Their lesson: “Authenticate the host explicitly, pass user identity through when required, and keep client credentials server-side” (S1).
Never a password, never a shared secret
Section titled “Never a password, never a shared secret”Two rules from earlier chapters matter even more for agents.
Never a password. An agent should never hold a person’s username and password. The username-password flow is retiring on 2027-02-20 for a reason (chapter 5, module 4), and an agent that types a password is that flow with less supervision. If a person must be there, they sign in themselves and approve; if they aren’t, the JWT bearer or token exchange flow carries them without a password.
Never a shared secret where it can be read. A client secret belongs on a server. Salesforce’s own setup guide for its MCP servers says to require a secret only for web-based clients “where the secret can be securely stored on the server side,” and to avoid it in desktop apps, because “embedded secrets in desktop applications can potentially be exposed through decompilation” (S6). An agent on a laptop or in a browser is a public client (chapter 15, module 3): PKCE, not a secret.
What’s next
Section titled “What’s next”Module 3: acting for someone. When the agent carries a person, how much of the person should it carry?
What an architect decides here
Section titled “What an architect decides here”- For each agent: as itself, or as someone. Decided by whose work it is.
- Which flow, from Salesforce’s connection table and chapter 5’s map.
- A dedicated integration user for every agent that acts as itself, never a shared one.
- Where the secret lives, and PKCE wherever it can’t be kept.
Explore
Section titled “Explore”- Trust for the Agentic Enterprise (opens in a new tab) (Salesforce Architects, Well-Architected; checked 2026-11-21)
- Create an External Client App (Hosted MCP Servers) (opens in a new tab) (Salesforce Developers; checked 2026-11-21)
