Skip to main content

Chrome postman for Rest API testing using Salesforce OAuth 2.0 connected apps in Salesforce.com

For testing Rest APIs using Salesforce Connected app OAuth 2.0 configuration using CHROME Postman. Follow these steps.

1. Create a Connected App

Go to -> your name -> setup -> App -> Connected App -> Click "new"
Populated necessary access and details , it should looks like as per the screenshot below 

Chrome postman for Rest API testing using Salesforce OAuth 2.0 connected apps


You will get a consumer key (Client_Id) and a Consumer secret (Client_Secret) . Keep these information handy , we will need it while setting up OAuth in Postman.
Important step :
In your connected app make sure the Callback URL is :-
https://www.getpostman.com/oauth2/callback

2. Setup Authorization in Chrome Postman

Open the chrome postman client and create one request . Save it to any collection or create new.
Select below configuration :-

Method : POST 
URL : https://www.getpostman.com/oauth2/callback

Chrome postman for Rest API testing using Salesforce OAuth 2.0 connected apps


a.) Go to Authorization tab and select OAuth 2.0 and click "Get New Access Token" button
Fill out the OAuth details from the newly created connected app.

b.) When you select Get New Access Token you can use these endpoints :-
  • Auth URL: https://login.salesforce.com/services/oauth2/authorize  (Replace 'login in URL with ''test'  for sandbox)
  • Access Token URL: https://login.salesforce.com/services/oauth2/token  (Replace 'login in URL with ''test'  for sandbox)
  • Client Id: <Choose from app> 
  • Client Secret: <Choose from app> 
  • Grant Type: Authorization 


Chrome postman for Rest API testing in Salesforce OAuth 2.0


c.)  When you click 'Request Token' you will be redirected to your salesforce login page. Once you log in you will be asked to give access through your Connected App (select Yes).

Note : If you are using Postman Desktop App , Please make sure you select "
Client Authentication" as "Send Client Credentials in Body"

d.)  In the Postman you should see your Access Token that was returned. Click 'Use Token' and it will add it to the Header section. You can verify this by clicking Headers and it should be

Authorization : Bearer <access_token>. 


Chrome postman for Rest API testing using Salesforce OAuth 2.0 connected apps


Chrome postman for Rest API testing in Salesforce OAuth 2.0

e.) Add the access token in your REST service URL of type GET method.
https://<your instance>.salesforce.com/services/apexrest/Case/<case id>

f.)  Select 'Send' and you should see the Case info returned as a response. 

Comments

Popular posts from this blog

Einstein Bot user authentication

Using Bot for data manipulation use case in your company requires need of implementing some extra security layer to make it spoof proof. One of exciting salesforce feature we have is the well known Einstein Bot which many companies have implemented. I am going to cover detail step-by-step implementation of User validation use case using encrypted token. STEP-1: Create a Site & Site User go to setup > Sites & Domains > Sites Create a Site and make your user as "Site Contact". This is a prerequisites for live agent or Embedded Service setup. STEP-2 : Create a Embedded Service(formerly snap-ins) go to Service setup > Embedded Service Create a new Embedded Service Deployment record and copy the embedded service code snipped generated in a notepad. STEP-3  : Create a Visualforce page to test the chatbot (it will simulate the actual web portal which is going to consume the embedded service snipped.) BotController.apxc public class BotControlle...

Dynamically populate lightning:combobox

In order to dynamically populate values in lightning:combobox using javascript we can create a list variable and push the values. We also require the values like ids associated to the particular option for back-end logic. For example  : If we want to show the list of contacts using lightning:combobox component where the option should display the contact name but the value should be the contact id which will be used for back-end logic For this we can create a temporary Map variable in our lightning component and set the value and label parameters of the lightning:combobox. Here is the code for this component Combo.app <aura:application extends="force:slds" access="global" description="Lightning Combo Demo"> <c:Combo_Cmpt/> </aura:application> Combo_Cmpt.cmp <aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="ComboController"> <!-- ...

Use of wrapper class in lightning:datatable

As you guys know the wrapper class concept in visualforce pages , we generally use it to create a data-table which fetches data from different objects or if we want to redirect user to some other page on click of a link as one of the column of data-table.        For example we want a column "Account Name" on the data-table which is a link and once user clicks it should redirect respective account record. Or , suppose we want to display a column with some images or icons as a visual indicator Or what not. These requirements require us to use a wrapper on the lighting data-table (lightning:datatable) I am going to use my previous account search example ( Account Search Lightning Component ) and explain the use of wrapper. AccountSearchWrapper.app <aura:application extends="force:slds" access="global" >     <c:AccountSearchWrapper /> </aura:application> AccountSearchWrapper.cmp <aura:component controller="...