Posts

Showing posts with the label HTTP

Salesforce - JWT Bearer Flow for Authentication

Image
Hello Trailblazers,  In this blog we are going to focus on OAuth 2.0 JWT Bearer Flow for Server-to-Server Integration. JWT Bearer Flow is used for server to server communication and to avoid logging in each time.  JWT Bearer Token is something that you provide to some other service to let that service authenticate you. This flow uses a certificate to sign the JWT request and doesn’t require explicit user interaction. However, this flow does require prior approval of the client app. Which means you need to allow access first for the connected app by using some third-party authorization app. So, we can consider JWT as a key which gives us access to various things. Pre-requisites for JWT(JSON Web Token) Bearer Flow X509 certificate Connected App X509 certificate  Since we will be signing JWT using RSA SHA256, we need certificate as a secret for signing data. You can download certificate from Salesforce or you can use openssl for ge...

Salesforce External Services

Image
Hello Trailblazers,   Today we will discuss about another no/low code feature of Salesforce – External Services. Whenever delivering an application if you can provide 360-degree view of products or services on a single platform then it becomes important factor which can affect customer satisfaction in positive way. And integrations help us in achieving the same by allowing us to connect to various services to get data or process data. In traditional approach we were using apex classes to implement REST integration with the help of endpoints and other necessary details. But Salesforce has now come up with External Services with the help of which you can connect your Salesforce Org to any RESTful service with the help of API Specification. So now onwards whenever you have to call any external web service just perform below steps and you will be able to connect your org without any code – Get API Specification File* from web service provider Create Named Credentials Register your...

How to make HTTP callout from LWC

Image
Hello Trailblazers, In this blog we are going discuss about HTTP callouts from Client-side controller in LWC. In Aura components we have Apex controller with AuraEnabled method which have code for HTTP callout in it. We call this Apex method on execution of some action and then send the response back to Aura component for processing. But with Lightning Web Components we can easily make callout from Javascript itself using fetch method. If you are not familiar with fetch method then please checkout this link . fetch method primarily takes 2 parameters as input which are endpoint and information about request which includes method type, header information , body of the request all in JSON format. fetch(endpont, { REQUEST_INFO}).then((response => response.json())).then((responseData) => {PROCESS_responseData_HERE}); Let’s start with the implementation. I am going to use Data Faker Heroku app for demonstration. In this example I will be focusing on getting data from third party so ...