您在此处:
什么是命名凭据?
使用带有 Apex 的 HTTP 标注,您可以通过 SOAP 和 REST API 将 Salesforce 与外部系统集成在一起。命名凭据提供了一种声明性的安全方式来存储和管理 HTTP 标注所需的凭据,以便 Salesforce 可以使用外部 API 进行身份验证。
使用带有 Apex 的 HTTP 标注,您可以通过 SOAP 和 REST API 将 Salesforce 与外部系统集成在一起。命名凭据提供了一种声明性的安全方式来存储和管理 HTTP 标注所需的凭据,以便 Salesforce 可以使用外部 API 进行身份验证。
| 适用于:Salesforce Classic(并非在所有组织中可用)和 Lightning Experience |
| 在所有版本中可用 |
命名凭据指定标注端点的 URL 及其在一个定义中所需的认证参数。要简化经过身份验证的标注的设置,可以使用命名凭据作为标注端点。通过将端点 URL 和身份验证从标注定义中分离出来,命名凭据使标注易于维护。例如,如果端点 URL 更改,您仅更新命名凭据,而不是更新 Apex 代码。所有引用命名凭据的标注都将继续工作。
这些类型的标注定义支持命名凭据。
Salesforce 管理将命名凭据指定为标注端点的标注的所有身份验证。对于在命名凭据中定义的站点,您也可以跳过远程站点设置,标注到外部站点需要该设置。
为了匹配外部系统的要求,命名凭据支持各种身份验证协议,您可以设置每个命名凭据,以使用组织范围内的命名首要或每用户身份验证。命名首要对整个组织应用相同的凭据或身份验证配置,而每用户身份验证在单个用户级别提供访问控制。
如果您有多个组织,可以在每个组织中创建具有相同名称(但又具有不同端点 URL)的命名凭据。然后,您可以在引用这些命名凭据的共享名称的所有组织上打包和部署标注定义。例如,每个组织中的命名凭据都可以拥有不同的端点 URL,以便适应开发和生产环境的差异。如果 Apex 标注指定这些命名凭据的共享名称,则可以在所有组织上封装并部署定义标注的 Apex 类,而无需以编程的方式检查环境。
我们建议通过 Salesforce UI 创建命名凭据和外部凭据。您也可以通过元数据 API、工具和连接 REST API 创建凭据。

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.