Integration - Exposing Salesforce Data

By in
35
Integration - Exposing Salesforce Data

At times, it’s required for you to share Salesforce object’s data with external systems for Integration. You can do it by using a Salesforce connected app and an Apex Class that exposes data.

 

Steps for Salesforce Integration

You need a Connected App for your custom API to be exposed to an external system. In the Connected App, you define different things the user can do once he is authenticated to Salesforce. To create a connected App follow these steps

  1. Go to Setup.
  2. Search for App Manager. Salesforce New Connected App
  3. Click on New Connected App.
  4. Give the Name and API Name for the app and click on Enable OAuth Settings. Salesforce Integration with External System
  5. Here you can set what type of access will the user of this app have.
  6. Click on Save.
  7. When the connected App is created, you can see the below details that can be used for authentication.
  8. We will discuss on authentication in the next part.

 

Common OAuth Terms

Access Token

For security reasons, we can’t give password of the Salesforce User to any external system. Hence instead of using the user’s Salesforce credentials, a connected app can use an access token to grant access to protected resources on behalf of the user.

For OAuth 1.0.A, the access token must be exchanged for a session ID.

For OAuth 2.0, the access token is a session ID and can be used directly.

Authorization Code

Only used in OAuth 2.0 with the web server flow, the authorization code is a token that represents the access granted by the end user. The authorization code is used to obtain an access token and a refresh token. It expires after 15 minutes.

 

Conclusion

To successfully set up a Salesforce integration with an external system, you need to first set up a connection with a connected app. Then expose the Salesforce data afterward, as the API you expose needs to be authenticated first. We will discuss more in the next part.

 

To learn more about what Apex can do for your org, check out some of my related blogs below!

 

Additional Settings

Cover Photo by ANIRUDH on Unsplash

Leave a reply

Your email address will not be published. Required fields are marked *