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
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 :-
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
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
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>.
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>.
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
Post a Comment