Salesforce – General Setup

Setup & Authentication

Overview

This guide takes you through the 2 types of authentication available for the following Cyclr Connectors:

IMPORTANT: Salesforce have made several large changes to how API access is setup.

One important change is that the original Salesforce “Connected Apps” are no longer supported and new ones cannot be created. Existing Connected Apps that are already in use will continue to function for the time being, but if a new customer attempts to install a Cyclr Salesforce Connector, they may see an error message and the installation will fail.


Instead of Connected Apps, Salesforce now recommends using External Client Apps (ECAs), which are created – and function – differently.

If you have any questions, please raise a Support Ticket through the Cyclr Support Center.

“OAuth 2.0 Authorization Code” Authentication Type

The OAuth 2.0 Authorization Code flow is available for all Connectors that use what Salesforce’s documentation refers to as the “Authorization Code and Credentials Flow”.

This is different to “OAuth 2.0 Client Credentials“, which is a separate authentication type available only for the Cyclr “Salesforce” Connector, and is covered later in this guide.

A Salesforce External Client App (ECA) must be created to use this authentication type.

If you create the Salesforce ECA yourself, you could then choose to store its Consumer Key and Consumer Secret in your Cyclr Partner Console so they’re always used when installing that Connector and your customers don’t need to provide their own/create their own App.

Note: To avoid complex setup being required by each of your customers, it’s often better for a single App to be created by you – as the Cyclr Partner – within a Salesforce Developer Edition organization.
See the Warning box directly beneath for an exception to this.

The Consumer Id and Consumer Secret values of a single App can then be set within your Console in the Application Connector Library entry for the Connector, providing a smoother installation experience of the Connector for your customers.

If the Consumer Id and Consumer Secret values are not provided in your Console’s Application Connector Library entry, Cyclr will request them every time the Connector is installed.

For more information, see the “Settings tab” section of the Installation User Experience page.

Due to the complexity of creating a Salesforce External Client App (ECA) for use across multiple Salesforce organizations, you may decide that a single App is not an option for you.

Warning: Specifically when setting up the “Salesforce” Cyclr Connector – as it supports both Client Credentials and Authorization Code authentication types – if you also wish to use the Client Credentials flow, you must not set the Consumer Key and Secret values in your Cyclr Console’s “Salesforce” Application Connector Library entry.
If you do, those details will automatically be used for both Client Credentials and Authorization Code, which are unlikely to be valid for both so will cause one of the authentication types to fail when used.
If you plan to use Client Credentials at any point, the fields for your Cyclr Console’s Connector Library “Salesforce” entry must be left blank.

When creating an app in Salesforce yourself, if you don’t have a Salesforce organization to create it in, you can register for a free Salesforce Developer Edition org through the Salesforce website.

Warning: You can use any Salesforce organization to create your App, but note that Sandbox organizations destroy apps when they are refreshed.

Remote Setup in Salesforce – typically performed by Cyclr Partner

Create an External Client App (ECA) in Salesforce to obtain a Consumer Key and Consumer Secret by following the Salesforce articles linked below.

Packaging an ECA for use across multiple Salesforce organizations requires use of Salesforce’s CLI tool and other technical setup within Salesforce, and as a result is outside the scope of this Connector Guide.

Depending on your familiarity with Salesforce, it may instead be more appropriate to have each of your customers create their own local ECA within their own Salesforce organization and to leave your Console-level values blank.

Useful Salesforce links explaining creation and setup of ECAs:

Pointers on creating an ECA within Salesforce:

  • Set the App’s Callback URL to the Callback URL of your Cyclr Partner Console.
  • The following OAuth Scopes must be added:
    • Manage user data via APIS (api)
    • Perform requests at any time (refresh_token, offline_access)
  • Configure the Flow Enablement and Security sections as follows:

After creating an ECA, you’ll be able to view further options for it:

  • On the Policies tab:
    • Select the Edit button to edit the App.
    • Select the OAuth Policies heading to expand.
    • Under the App Authorization, set the Refresh Token Policy to Refresh token is valid until revoked or Expire refresh token if not used for specific time with a period of at least 24 hours.
      This ensures that authentication is maintained for Connectors in Cyclr that are not actively in use.
  • On the Settings tab:
    • Select the OAuth Settings heading to expand.
    • Under the App Settings section, select the Consumer Key and Secret button.
    • Make a note of the Consumer Key and Consumer Secret values displayed on the next page.

Partner Setup in Cyclr Console

Having created an ECA within Salesforce to obtain a Consumer Key and Consumer Secret, and packaged it within Salesforce so it’s available for use across multiple Salesforce organizations, go into your Cyclr Partner Console:

Note: If you choose not to package your ECA for use in multiple Salesforce organizations, you should leave the below values blank, and instead have each of your customers create their own ECA within their own Salesforce organizations. With the below values blank, Cyclr will request the Consumer Key and Consumer Secret from your customers at the point of authenticating the Connector.

  1. Go to Connector Library > Application Connectors.
  2. Use the search box to locate the type of Salesforce Connector you’re setting up, e.g. Salesforce, Salesforce Marketing Cloud, etc.
  3. Select the Pencil button.
  4. Select the Settings tab.
  5. Enter the following values:
PropertyDescription
Consumer KeyThe Consumer Key of the External Client App to connect through.
Consumer SecretThe Consumer Secret of the External Client App to connect through.
Is Sandbox?Not shown for all types of Cyclr Salesforce Connectors.

Whether the Salesforce organizations to be accessed by the Connector are sandbox or production orgs.
* true – for sandbox orgs
* false – for production orgs (typical setting)
Disable Adding Options to Custom Fields?* Set to true to ignore Salesforce pick list values when Cyclr automatically adds any custom fields.
* Set to false to add Salesforce pick list values as selectable options when Cyclr automatically adds any custom fields.

Defaults to false
  1. Select Save Changes.

Note: If you leave these values blank, they must be provided each time that type of Salesforce Connector is installed.

Cyclr Connector Installation

When installing the Connector, your customer will be taken to a Salesforce login page to sign in and provide consent for the ECA to access their data.

The user authenticating the Cyclr Connector should have the following permissions within their Salesforce organization, otherwise authentication may fail, depending on the permissions and roles configured in that organization:

  • Customize Application
  • Modify All Data

“OAuth 2.0 Client Credentials” Authentication Type

The OAuth 2.0 Client Credentials authentication type is only available for the Cyclr “Salesforce” Connector.
It is not available for the Salesforce Marketing Cloud or Salesforce Service Cloud Connectors.

See above for details on the alternative “OAuth 2.0 Authorization Code” authentication type.

Note: This setup is completed within the Salesforce organization of each of your customers, not within your own.

Your customer must perform the following:

  1. Obtain the Domain URL of their Salesforce organization.
  2. Create a Salesforce External Client App (ECA) within their Salesforce organization to obtain a Consumer Key and Consumer Secret.

Remote Setup in Salesforce – performed by your customer

1. Obtain Domain URL

Your customer must obtain the Domain URL of their Salesforce organization.

From within their Salesforce organization:

  • Go to Setup.
  • Enter My Domain in the Quick Find box.
  • Select My Domain.
  • Make a note of the Current My Domain URL value under the My Domain Details heading.

2. Create a Salesforce External Client App (ECA)

Your customer must create an External Client App in Salesforce to obtain a Consumer Key and Consumer Secret.

See Salesforce’s guide for more on creating an ECA for use with Client Credentials authentication.

When your customer is creating their ECA:

  • While not actually used by Client Credentials authentication, your customer should set the App’s Callback URL to the Callback URL of your Cyclr Partner Console.
  • They must add the following OAuth Scopes:
    • Manage user data via APIS (api)
  • They must configure the Flow Enablement and Security sections as follows:
    (none of the Security options should be selected)

Once your customer has created an ECA, still within Salesforce, they must select it from the External Client App Manager page:

  • On the Policies tab:
    • Select the Edit button to edit the App.
    • Select the OAuth Policies heading to expand.
    • Under the OAuth Flows and External Client App Enhancements section, check the Enable Client Credentials Flow.
    • In the Run As (Username) field set a username.
    • Select the Save button.
  • On the Settings tab:
    • Select the OAuth Settings heading to expand.
    • Under the App Settings section, select the Consumer Key and Secret button.
    • Make a note of the Consumer Key and Consumer Secret values.

Partner Setup in Cyclr Console

Once your customer has created an ECA within their Salesforce organization to obtain a Consumer Key and Consumer Secret, go into your Cyclr Partner Console:

Warning: You must leave the Consumer Key and Consumer Secret fields blank in your Connector Library when using the Salesforce Connector’s OAuth 2.0 Client Credentials authentication type so that they are entered each time a Salesforce Connector is authenticated.
If values are already present here, you should not remove them as they may have been set as part of using the OAuth 2.0 Authorization Code flow by existing installed Connectors. Removing them will likely result in those Connectors losing authentication, causing errors in running integrations that use them. Check with your colleagues before continuing.

  1. Go to Connectors > Application Connector Library.
  2. Use the search box to locate the Salesforce Connector entry.
  3. Select the Pencil button.
  4. Select the Settings tab.
  5. Enter the following values:
PropertyDescription
Consumer KeyMust be blank so the customer provides it when authenticating.
Consumer SecretMust be blank so the customer provides it when authenticating.
Is Sandbox?Ignored by the Client Credentials authentication type.
Disable Adding Options to
Custom Fields?
* Set to true to ignore Salesforce pick list values when Cyclr automatically adds any custom fields.
* Set to false to add Salesforce pick list values as selectable options when Cyclr automatically adds any custom fields.

Defaults to false

Cyclr Connector Installation

When installing a Salesforce Connector using OAuth 2.0 Client Credentials, the following values are used:

PropertyDescription
Consumer KeyThe Consumer Key of your customer’s ECA to connect through.
Consumer SecretThe Consumer Secret of your customer’s ECA to connect through.
Domain URLThe domain URL of the customer’s Salesforce organization.

Troubleshooting

Updates to Salesforce apps are not immediate

After creating or making changes to a Salesforce External Client App, it can take 5 to 10 minutes to take effect across all of Salesforce’s systems.

During that time, you may encounter errors similar to this when attempting to install or setup a related Connector within Cyclr:

Other error values you may encounter when awaiting updates to an ECA across Salesforce’s systems:

  • error=invalid_client_id
  • error=redirect_uri_mismatch

Confirm the values are set correctly on the Salesforce app and within Cyclr, then wait a further 10 minutes before retrying.

OAuth 2.0 Authorization Errors

When authenticating one of the Salesforce Connectors within Cyclr, it’s possible the user may see an error that includes a short code from Salesforce, identifying where the issue was, for example:

  • invalid_grant
  • inactive_user
  • invalid_client

These and other error codes are described within Salesforce’s documentation.

You should also be aware that changes to apps within Salesforce can take up to 10 minutes to take effect across their systems, as described above.

Expired Access or Refresh Token Errors

Salesforce only allows up to 5 unique access/refresh token pairs to be issued for each user in an External Client App.

Older tokens will be automatically revoked by Salesforce.

This can result in Connectors becoming unauthenticated if you authenticate using the same user on multiple Connectors.

See this Salesforce article for more information.