Pre-requisites

  1. Salesforce Developer Account.
  2. Required Settings for the App. You can find it in Overview.

While calling Salesforce API, you might get the error The REST API is not enabled for this Organization. To solve this, go to Manage User -> User -> System Administraiton -> Administrative Permission -> Check API Enable checkbox.

Creating an app in Salesforce

To create a Salesforce app and aquire the app credentials, please follow the steps mentioned below:

  1. Log in to your Salesforce dashboard with your developer account credentials.
  2. Click on the Gear icon in the top right and select Open Advanced Setup button.
  1. Select Apps > App Manager options from the left side menu under Platform Tools section.
  2. Select New Connected App button in the setup page.
  3. Enter the basic details of your application
  4. Under API (Enable OAuth Settings), mark the Enable OAuth Settings checkbox.
  5. Enter the Callback URL as provided in your Salesforce settings page in Cobalt. Go to your Apps catalog > Search for Salesforce > Settings > Use your credentials > Callback Url.
  6. Select the required scopes, atleast the scopes selected in your Cobalt Salesforce settings page.
  7. Enable the following App Settings, click on the Save button and click Continue.
    • Require Secret for Refresh Token flow
    • Enable Authorization Code and Credentials Flow
    • Enable Token Exchange Flow
    • Require Secret for Token Exchange Flow
    • Issue JSON Web Token (JWT)-based access tokens for named users
  1. Click on the Manage Consumer Details button under the API (Enable OAuth Settings) section, verify your identity and copy the Consumer Key and Consumer Secret.

Configuring credentials in Cobalt

App settings page lets you configure the authentication settings for an OAuth2 based application. For your customers to provide you authorization to access their data, they would first need to install your application. This page lets you set up your application credentials.

Cobalt lets you use pre-configured applications to play around. You can do so by selecting Use our credentials. However, if you wish to use your own application, select Use your own credentials. Provide the aquired Client Id and Client secret and save it.

Configuring Scopes

Cobalt lets you configure what permissions to ask from your users while they install your application. The scopes can be added or removed from the App settings page, under Permissions & Scopes section.

For some applications Cobalt sets mandatory scopes which cannot be removed. Additional scopes can be selected from the drop down. Cobalt also has the provision to add any custom scopes supported by the respective platform.

Once the scopes has been added to the application in Cobalt, go to your Salesforce developer account dashboard and update the scopes as added on Cobalt.

Navigate to Apps > App Manager > Select the OAuth App created for Cobalt > Click on the dropdown menu > Select Edit > Selected OAuth Scopes > Add the scopes as added in Cobalt and click on Save.

If you are facing scopes missing or invalid scope error. Make sure you are not passing any custom scope not supported by the platform. And, the scopes selected here are identical to the ones selected in the platform.