Newer Version Available
ConnectedApp
This type extends the Metadata metadata type and inherits its fullName field.
File Suffix and Directory Location
ConnectedApp components have the suffix .connectedApp and are stored in the connectedApps folder.
Version
ConnectedApp components are available in API version 29.0 and later.
Fields
| Field Name | Field Type | Description |
|---|---|---|
| attributes | ConnectedAppAttribute | A custom attribute of the connected app. |
| canvasConfig | ConnectedAppCanvasConfig | The configuration options of the connected app if it’s exposed as a canvas app. |
| contactEmail | string | Required. The email address Salesforce uses for contacting you or your support team. |
| contactPhone | string | The phone number for Salesforce to use to contact you. |
| description | string | An optional description for your application. |
| iconUrl | string | Reserved for future use. |
| infoUrl | string | An optional URL for a web page with more information about your application. |
| ipRanges | ConnectedAppIpRange | Specifies the ranges of IP addresses that can access the app without requiring the user to authenticate with the connected app. |
| label | string | Required. The name of the app. |
| logoUrl | string | An optional application logo. The logo appears with the application’s entry in the list of apps and on the consent page the user sees when authenticating. The URL must use HTTPS, and the logo can’t be larger than 125 pixels high or 200 pixels wide. The default logo is a cloud. |
| mobileStartUrl | string | Users are directed to this URL after they’ve authenticated when the app is accessed from a mobile device. If you don’t give a URL, the user is sent to the application’s default start page after authentication completes. If the connected app that you’re creating is a canvas app, then you can leave this field blank. The Canvas App URL field contains the URL that gets called for the connected app. |
| oauthConfig | ConnectedAppOauthConfig | Specifies how your application communicates with Salesforce. |
| permissionSetName | string | Specifies the permissions required to perform different functions with the
connected app. Available in API version 46.0 and later. You can assign multiple permission sets to the connected app, but you must enter each permission set name on a separate line. You can’t enter the same permission set name more than one time for each connected app. You can also change a permission set by replacing the current permission set with a new permission set. Make sure that each permission set name assigned to the connected app is unique. You can delete individual permission sets or remove all permission sets from a connected app by entering an empty permissionSetName string on deployment of the connected app (<permissionSetName></permissionSetName>). |
| plugin | string | The name of a custom Apex class that extends Auth.ConnectedAppPlugin to customize the behavior of the app. |
| pluginExecutionUser | string | Specifies the user to run the plugin as. If the user isn’t authorized to use
the connected app, use the authorize method.
See the ConnectedAppPlugin class in the Apex Developer Guide. Available in API
version 46.0 and later. Enter a user that is part of your org. Otherwise, the user is removed from this field when you deploy the connected app. If you don’t want to specify a user, you can leave this field empty. |
| profileName | string | Specifies the profile (base-level user permissions) required to perform
different functions with the connected app. Available in API version 46.0 and
later. You can assign multiple profiles to the connected app, but you must enter each profile name on a separate line. You can’t enter the same profile name more than one time for each connected app. You can also change profiles by replacing the current profiles with new profiles. Make sure that each profile name assigned to the connected app is unique. You can also delete individual profiles, or remove all profiles from a connected app by entering an empty profileName string on deployment of the connected app (<profileName></profileName>). |
| samlConfig | ConnectedAppSamlConfig | Controls how the app uses single sign-on. |
| startUrl | string | If the app is not accessed from a mobile device, users are directed to this URL after they’ve authenticated. If you don’t give a URL, the user is sent to the application’s default start page after authentication completes. If the app is accessed from a mobile device, see mobileStartUrl. If the connected app that you’re creating is a canvas app, then you can leave this field empty. The Canvas App URL field contains the URL that gets called for the connected app. |
ConnectedAppAttribute
Represents the field names that make up a custom attribute when using SAML with a ConnectedApp. Tailor these values to a specific service provider.
| Field Name | Field Type | Description |
|---|---|---|
| formula | string | Required. The value of the attribute. |
| key | string | Required. The attribute’s identifier. |
ConnectedAppCanvasConfig
The configuration options of the connected app if it’s exposed as a canvas app.
| Field Name | Field Type | Description |
|---|---|---|
| accessMethod | AccessMethod (enumeration of type string) | Required. Indicates how the canvas app initiates the OAuth authentication flow.
The valid values are:
|
| canvasUrl | string | Required. The URL of the third-party app that’s exposed as a canvas app. |
| lifecycleClass | string |
The name of the Canvas.CanvasLifecycleHandler Apex class, if you’ve implemented
this class for custom parameters. This field is available in API version 31.0 and later. |
| locations | CanvasLocationOptions (enumeration of type string) | Indicates where the canvas app can appear to the user. The valid values are:
|
| options | CanvasOptions (enumeration of type string) | Indicates whether to hide the share button and header in the publisher for your
canvas app, and whether the app is a canvas personal app. Valid values are:
|
| samlInitiationMethod | SamlInitiationMethod (enumeration of type string) |
If you’re using SAML single sign-on
(SSO), indicates which provider initiates the SSO flow.
This field is available in API version 31.0 and later. |
ConnectedAppIpRange
The list of IP addresses that can access the app without requiring the user to authenticate.
| Field Name | Field Type | Description |
|---|---|---|
| description | string | Use this field to identify the purpose of the range, such as which part of a network corresponds to this range. This field is available in API version 31.0 and later. |
| startAddress | string | Required. The first address in the IP range, inclusive. |
| endAddress | string | Required. The last address in the IP range, inclusive. |
ConnectedAppOauthConfig
Represents the field names that configure how your application communicates with Salesforce.
| Field Name | Field Type | Description |
|---|---|---|
| callbackUrl | string | Required. The endpoint that Salesforce calls back to your application during OAuth; it’s the OAuth redirect_uri. |
| certificate | string | The PEM-encoded certificate string, if the app uses a certificate. |
| consumerKey | string | A value used by the consumer for identification to Salesforce. Referred to as
client_id in OAuth 2.0. In API version 32.0 and later, you can set this field’s value only during creation. After you define and save the value, it can’t be edited. The value must be alphanumeric, can’t contain special characters or spaces, and must be between 8 and 256 characters. Consumer keys must be globally unique. |
| consumerSecret | string |
A value that is combined with the
consumerKey and used by the consumer for identification to
Salesforce. Referred to as client_secret in
OAuth 2.0. Typically, Salesforce generates this value when you create the
connected app. However, you can customize the shared secret value during creation.
After you save the value, it can’t be edited. When set, the value is not returned
in metadata API requests. The value must be alphanumeric (no special characters and no spaces) and a minimum of 8 characters (maximum of 256 characters). If you specify a secret already in use for another connected app in the organization, an error occurs. This field is available in API version 32.0 and later. |
| idTokenConfig | ConnectedAppOauthIdToken | Specifies the ID token configuration for the connected app OAuth settings. Available in API version 43.0 and later. |
| isAdminApproved | boolean | If set to false (default setting), anyone
in the org can authorize the app. Users must approve the app the first time they
access it. If set to true, only users with the appropriate profile or permission set can access the app. These users don’t have to approve the app before they can access it. Manage profiles for the app by editing each profile’s Connected App Access list. Manage permission sets for the app by editing each permission set’s Assigned Connected App list. This setting is not available in Group Edition. Available in API version 46.0 and later. |
| scopes | ConnectedAppOauthAccessScope (enumeration of type string) | The scopes refer to permissions given by the user running the connected app.
When deploying metadata, valid values are:
When retrieving metadata, valid values are:
|
| singleLogoutUrl | string | The single logout endpoint. This URL is the endpoint where Salesforce sends a logout request when users log out of Salesforce. |
ConnectedAppOauthIdToken
Specifies the ID token configuration for the connected app OAuth settings. Available in API version 43.0 and later.
| Field Name | Field Type | Description |
|---|---|---|
| idTokenAudience | string | The audiences that this ID token is intended for. The value is an array of case-sensitive strings. If no audiences are specified, the OAuth 2.0 client_id of the relying party is returned as the default audience. Otherwise, the other audiences are returned with the client_id in the aud value. |
| idTokenIncludeAttributes | boolean | Indicates whether attributes are included in the ID token. |
| idTokenIncludeCustomPerms | boolean | Indicates whether custom permissions are included in the ID token. |
| idTokenIncludeStandardClaims | boolean | Indicates whether standard claims about the authentication event are included in the ID token. |
| idTokenValidity | int | The length of time that the ID token is valid for after it’s issued. The value can be from 1 to 720 minutes. The default is 2 minutes. |
ConnectedAppSamlConfig
Specifies how an app uses single sign-on.
Declarative Metadata Sample Definition
The following is an example package manifest used to deploy or retrieve the ConnectedApp metadata for an organization.
1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3 <types>
4 <members>PortalTestApp</members>
5 <name>ConnectedApp</name>
6 </types>
7 <version>29.0</version>
8</Package>The following is an example of a ConnectedApp component.
1<?xml version="1.0" encoding="UTF-8"?>
2<ConnectedApp xmlns="http://soap.sforce.com/2006/04/metadata">
3 <fullName>AConnectedApp</fullName>
4 <attributes>
5 <formula>$User.CompanyName</formula>
6 <key>companyName</key>
7 </attributes>
8 <contactEmail>user@company.com</contactEmail>
9 <mobileStartUrl>https://m.connectedapp.company.com</mobileStartUrl> <label>A ConnectedApp</label>
10 <oauthConfig>
11 <callbackUrl>https://callback.yourcompany.com</callbackUrl>
12 <consumerKey>***********************************************</consumerKey>
13 <isAdminApproved>true</isAdminApproved>
14 <scopes>Basic</scopes>
15 <scopes>Api</scopes>
16 <scopes>Web</scopes>
17 <scopes>Full</scopes>
18 <scopes>Chatter</scopes>
19 <scopes>CustomApplications</scopes>
20 <scopes>RefreshToken</scopes>
21 <scopes>OpenID</scopes>
22 <scopes>CustomPermissions</scopes>
23 <scopes>Wave</scopes>
24 <scopes>Eclair</scopes>
25 </oauthConfig>
26 <permissionSetName>Advanced</permissionSetName>
27 <permissionSetName>Service</permissionSetName>
28 <profileName>Solution Manager</profileName>
29 <profileName>System Administrator</profileName>
30 <plugin>ConnectedAppPluginExample</plugin>
31 <pluginExecutionUser>admin@salesforce.org</pluginExecutionUser>
32 <startUrl>https://connectedapp.company.com</startUrl>
33 <ipRanges>
34 <endAddress>10.x.x.xx</endAddress>
35 <startAddress>10.x.x.yy</startAddress>
36 </ipRanges>
37</ConnectedApp>Usage
If you're constructing a SAML-enabled connected app using Metadata API, and must set the IdP-Initiated Login URL for your service provider, you have two options:
You can use the service provider app ID with the app parameter in the following format. This value is displayed in the Salesforce user interface. From Setup, enter Connected Apps in the Quick Find box, then select Connected Apps, then click the name of the connected app to see its detail page.
1https://<Salesforce_base_URL>/idp/login?app=<app_id>Or, if you’re configuring the connected app using Metadata API only, you can use the apiName parameter of the service provider app in the following format. The apiName parameter is the fullName inherited from the Metadata type.
1https://<Salesforce_base_URL>/idp/login?apiName=<fullName>Wildcard Support in the Manifest File
This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.