Salesforce REST API: How to Configure Salesforce Connected Apps for REST API Integration



Connected App is a framework that enables the external application to integrate with Salesforce using APIs and protocols. This framework uses standard protocols like SAML, OAuth & OpenID Connect for authenticating these external apps. 

In this article will see how we can create a connected app to enable integration with external applications.

Add Connected Apps

To start with “Go to the Setup Screen” and follow the steps below:

Step-1: Search for “App” using the search box

Step-2: Click “App Manager” 


Step-3: On the App Manager Setup Screen, click on “New Connected App”


Step-4: Specify the required details (App Name, API Name, Email) for the connected app under the basic information section


Step-5: Check “Enable OAuth Settings” under “API (Enable OAuth Settings)” section

Step-6: Select the required OAuth Scopes for this connected app. In this demo, we are just planning to access & manage data in Salesforce so the appropriate scope would be “Access & manage your data (api)”

It is important to understand the significance of each of the available scope to make a better decision so I would recommend visiting the following link from OAuth Scopes - Salesforce API documentation


Step-7: Specify the Callback URL as http://localhost, this URL will be invoked after OAuth Authentication is successful for the connected app or Consumer Application using this connected app in other words.


A callback URL is a URL that is invoked after OAuth authorization for the consumer (connected app). In some contexts, the URL must be a real URL that the client’s web browser is redirected to. In others, the URL isn’t actually used, but the value between your client app and the server (the connected app definition) must be the same. For example, you might want to use a value that identifies the app, such as https://MyCompany.Myapp.

Step-8: Save the settings for the connected app by clicking the “Save” button at the bottom.


Step-9: As per the Salesforce Notification, we should wait until the new connected app gets provisioned. The wait time could be between 2-10 minutes.

Step-10: Click “Continue” button if you want to keep moving on to the next screen, the connected app will still get provisioned in the background and you need to still wait until it is available.

We can observe the same message on the next screen as well if we wish to click “Continue”.


Step-11: Once the connected app is provisioned we can see some new values appeared under “API (Enable OAuth Settings)”. The value of “Consumer Key” field is worth noting, we will look for its usages in the upcoming articles.

Step-12: Similarly it is worth noting the value of “Consumer Secret” as well.
We should keep the values of “Consumer Key” & “Consumer Secret” handy in order to use them in the applications.


With this, we are done with adding a new connected app for the consumer applications and will see its usages in the upcoming articles.

Edit Connected Apps

Similarly we can edit the details of the connected apps by going to the Setup Page and Search for “App”

Step-1: Click “Manage Connected Apps” to get to the manage connected app page


Step-2: Find your App and click “Edit” next to it to get to the “Connected App Edit” Page



Step-3: On the “Connected App Edit” Page edit the details & configurations that suit your scenarios. For example, you could modify the “OAuth Policies” to make it the best fit for your implementations.


Conclusion

Connected App Framework enables client applications to integrate with Salesforce and access their data. It uses standard Web Protocols like SAML, OAuth and OpenID to authenticate external applications (Consumers) against the Salesforce Permission model and accordingly Consumer applications can get access based on OAuth Policies defined for the respective Connected App.

Hope you enjoyed this article. Please leave your comments to let me know how you do like the content and how you do find it helpful to learn the topic.

Comments