# Connecting to Salesforce

This connector enables you to connect to Salesforce as either a Source or a Target.

Prior to setting up the connector, you will need to prepare Salesforce. Specifically

- Create a Connected App
- Get some information from Salesforce for the connector: Consumer Key, Consumer Secret, and the Security Token for the identity that will be used to log into Salesforce

## Create or Edit a Connected App

Log into Salesforce with Administrator rights.

Go to: Create - Apps - Connected Apps

Click New to create a new App, and enter the following values.

- Connected App Name: Inaport
- API Name: Inaport
- Contact Email: Your email
- API (Enable OAuth Settigns): tick the box
- Callback URL: inaport:callback
- Selected OAuth Scopes: Select 'Full access' AND 'Perform requests on your behalf'

Click Save to save these settings. On the next page, make a note of:

- Consumer Key AND Consumer Secret. These are long magic values that are required to allow Inaport to connect to Salesforce.

Once the App has been created, click Manage and check the OAuth Policies

- IP Relaxation: Consider whether you want to relax IP Restrictions
- Refresh Token Policy: Select 'Refresh token is valid until revoked'

## Salesforce Connection Settings

Once you have set up the Connected App in Salesforce, you can create a connector in Inaport.

Consumer Key: enter the consumer key obtained from Salesforce.

Consumer Secret: enter the consumer secret obtained from Salesforce.

Inaport gives you two authentication methods: User Authentication and OAuth Authentication.

### Setting up User Authentication

Requires a user identity to log in with, and the users Security Token issued when the user is set up. If the token is not available, it can be reset:

- Log into Salesforce with the user identity
- Click on the user name in top right corner and choose 'Setup' from the menu.
- Select 'Personal', then 'Reset My Security Token'

### Setting up OAuth Authentication

OAuth does not require you to specify a user credential, but does require you to log into Salesforce and get a token. This token is then used by Inaport to log into Salesforce for integration.

The advantage of this approach is that the Salesforce administrator can revoke the token at any time, with out having to change the users credentials.

The disadvantage is that the token expires and has to be refreshed. Inaport will normally refresh the token automatically, but the process can generate errors and prevent Inaport from logging in.

To start the process:

- OAuth Call Back URL: default is 'inaport:callback', but enter whatever URL you provided when setting up the Connected App in Salesforce.
- Click the 'Get Token' button
- Inaport will then display a login page to Salesforce in the box below Get Token. Log in using appropriate credentials.
- Salesforce will then ask if you want to allow Inaport to connect. Say yes.
- Inaport will display a Message Box when the Token has been received.

Current Token: this displays the current token if Inaport already has one from Salesforce.