SlideShare a Scribd company logo
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
Salesforce
Developer Group
Bengaluru, India
@ SFDGBLR #SFDGBLR
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
OAuth Authorization
flows in Salesforce
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
TABLE OF
CONTENTS
Connected App
Creating Connected App and
Managing Connected App Usage
OAuth Web Server
Flow
Demo through Postman HTTP
Client
01
03
02
04
05
OAuth JWT Bearer
Token Flow
What is JWT? Walkthrough with
Postman HTTP Client
OAuth JWT Bearer
Token Flow in Apex
Apex Code Walkthrough to
connect one salesforce org to
another using named credentials
RESOURCES
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
Connected App
01
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
Connected App
A connected app is a framework that enables an external application to integrate with Salesforce using
APIs and standard protocols, such as SAML, OAuth, and OpenID Connect. Connected apps use these
protocols to authenticate, authorize, and provide single sign-on (SSO) for external apps.
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
1. Creating Connected App
2. Managing Connected App Usage and Policies.
DEMO
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
OAuth Web server
flow
02
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
OAuth Web server
flow
1. The external web service—via the connected app—posts an authorization
code request using the authorization code grant type to the Salesforce
authorization endpoint.
2. With an authorization code, the connected app can prove that it’s been
authorized as a safe visitor to the site and that it has permission to request
an access token.
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
1. OAuth Web server flow walkthrough with Postman
HTTP Client.
DEMO
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
1. https://login.salesforce.com/services/oauth2/autho
rize?client_id=xxx&redirect_uri=https://login.sale
sforce.com/oauth2/callback&response_type=code
2. Endpoint for access token:
https://login.salesforce.com/services/oauth2/token
POST /services/oauth2/token,Content-type:
application/x-www-form-
urlencoded,grant_type=authorization_code&code=from
step1(url
decoded)&client_id=xxx&client_secret=xxx&redirect_
uri=https://login.salesforce.com/oauth2/callback
Steps Involved in Web Server Flow
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
OAuth JWT Bearer
Token flow
03
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
OAuth JWT Bearer
Token flow
1. This is used for server to server integration scenarios.
2. 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. Please note this flows never issues a refresh token.
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
JWT Structure
Header -{"alg":"RS256"}
Payload (This contains claims information which
is an object containing information about user
and additional data.Claims are set using
parameters-"Iss,aud,sub,exp")
Signature
<headerbase64encodedurl>.<claimsbase64encodedclai
ms>.<signature(uses algorithm like RS 256)>
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
1. OAuth JWT Bearer Token flow walkthrough with
Postman HTTP Client.
DEMO
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
POST /services/oauth2/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
grant_type= urn:ietf:params:oauth:grant-type:jwt-
bearer&assertion=JWT token generated in JWT.io Website
Steps to be followed in Postman
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
OAuth JWT Bearer
Token flow Usage in
Apex
04
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
1. OAuth JWT Bearer Token flow (Apex code
walkthrough to integrate one salesforce org to
another using named credentials)
DEMO
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
Auth.JWT jwt = new Auth.JWT();
jwt.setSub('debarunsengupta2512@live.com');
jwt.setAud('https://login.salesforce.com'); jwt.setIss('connected app client
id');Auth.JWS jws = new Auth.JWS(jwt,’Certificate keystore name’);String token =
jws.getCompactSerialization();String tokenEndpoint =
'https://login.salesforce.com/services/oauth2/token';//POST the JWT bearer token
Auth.JWTBearerTokenExchange bearer = new Auth.JWTBearerTokenExchange(tokenEndpoint,
jws);
//Get the access token
String accessToken = bearer.getAccessToken();
system.debug('Access Token-->'+accessToken);
Apex Code without Named
Credentials
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
String service_limits='/services/data/v48.0/sobjects/Account/listviews/';
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:JWT_Demo'+service_limits);
req.setMethod('GET');
Http http = new Http();
HTTPResponse res = http.send(req);
System.debug(res.getBody());
System.debug(res.getstatuscode());
Apex Code with Named Credentials
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
Resources
05
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
1. https://help.salesforce.com/articleView?id=remoteaccess_oauth_jwt_flow.htm&type=5
2. https://jwt.io/
3. https://developer.salesforce.com/docs/atlas.en-
us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_key_and_cert.htm
4. https://www.base64encode.org/
5. https://www.freeformatter.com/json-formatter.html#ad-output
6. https://www.unixtimestamp.com/
Some Useful commands to convert .crt to keystore to store in SFDC
openssl pkcs12 -export -in server.crt -inkey server.pem -out testkeystore.p12
keytool -importkeystore -srckeystore testkeystore.p12 -srcstoretype pkcs12 -destkeystore servercert.jks -deststoretype JKS
keytool -keystore /<Path>/servercert.jks -changealias -alias 1 -destalias salesforcetest
Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR
CREDITS: This presentation template was created by Slidesgo, including
icons by Flaticon, and infographics & images by Freepik.
Please keep this slide for attribution.

More Related Content

What's hot

Salesforce administrator training presentation slides
Salesforce administrator training presentation slides Salesforce administrator training presentation slides
Salesforce administrator training presentation slides
Salesforce Associates
 
Session 1: INTRODUCTION TO SALESFORCE
Session 1: INTRODUCTION TO SALESFORCESession 1: INTRODUCTION TO SALESFORCE
Session 1: INTRODUCTION TO SALESFORCE
SmritiSharan1
 
Salesforce Service Cloud
Salesforce Service CloudSalesforce Service Cloud
Salesforce Service Cloud
sharad soni
 
Integration using Salesforce Canvas
Integration using Salesforce CanvasIntegration using Salesforce Canvas
Integration using Salesforce Canvas
Dhanik Sahni
 
Salesforce Online Training
Salesforce Online TrainingSalesforce Online Training
Salesforce Online Training
Keylabs
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
Salesforce Developers
 
Classic vs. lightning
Classic vs. lightningClassic vs. lightning
Classic vs. lightning
Gaurav Kumar
 
Salesforce 101
Salesforce 101Salesforce 101
Salesforce 101
501Partners
 
Pardot
PardotPardot
Pardot
SkyPlanner
 
Introduction to Lightning Web Component
Introduction to Lightning Web Component Introduction to Lightning Web Component
Introduction to Lightning Web Component
SmritiSharan1
 
Lightning Web Component in Salesforce
Lightning Web Component in SalesforceLightning Web Component in Salesforce
Lightning Web Component in Salesforce
Jitendra Zaa
 
Deep Dive into OAuth for Connected Apps
Deep Dive into OAuth for Connected AppsDeep Dive into OAuth for Connected Apps
Deep Dive into OAuth for Connected Apps
Salesforce Developers
 
Salesforce PPT.pptx
Salesforce PPT.pptxSalesforce PPT.pptx
Salesforce PPT.pptx
ShaikAllabakshu5
 
Automate All The Things with Flow
Automate All The Things with FlowAutomate All The Things with Flow
Automate All The Things with Flow
Salesforce Admins
 
Lightning web components - Introduction, component Lifecycle, Events, decorat...
Lightning web components - Introduction, component Lifecycle, Events, decorat...Lightning web components - Introduction, component Lifecycle, Events, decorat...
Lightning web components - Introduction, component Lifecycle, Events, decorat...
Nidhi Sharma
 
Salesforce Service Cloud - An overview
Salesforce Service Cloud - An overviewSalesforce Service Cloud - An overview
Salesforce Service Cloud - An overview
Ajay Balakrishnan
 
Deep dive into Salesforce Connected App
Deep dive into Salesforce Connected AppDeep dive into Salesforce Connected App
Deep dive into Salesforce Connected App
Dhanik Sahni
 
Reports and dashboards @salesforce
Reports and dashboards @salesforceReports and dashboards @salesforce
Reports and dashboards @salesforce
Kapil Kumar Patle
 
Endless Use Cases with Salesforce Experience Cloud by Dar Veverka
Endless Use Cases with Salesforce Experience Cloud by Dar VeverkaEndless Use Cases with Salesforce Experience Cloud by Dar Veverka
Endless Use Cases with Salesforce Experience Cloud by Dar Veverka
Alesia Dvorkina
 
CRM Salesforce Overview
CRM Salesforce OverviewCRM Salesforce Overview
CRM Salesforce Overview
Edureka!
 

What's hot (20)

Salesforce administrator training presentation slides
Salesforce administrator training presentation slides Salesforce administrator training presentation slides
Salesforce administrator training presentation slides
 
Session 1: INTRODUCTION TO SALESFORCE
Session 1: INTRODUCTION TO SALESFORCESession 1: INTRODUCTION TO SALESFORCE
Session 1: INTRODUCTION TO SALESFORCE
 
Salesforce Service Cloud
Salesforce Service CloudSalesforce Service Cloud
Salesforce Service Cloud
 
Integration using Salesforce Canvas
Integration using Salesforce CanvasIntegration using Salesforce Canvas
Integration using Salesforce Canvas
 
Salesforce Online Training
Salesforce Online TrainingSalesforce Online Training
Salesforce Online Training
 
Lightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An IntroductionLightning web components - Episode 1 - An Introduction
Lightning web components - Episode 1 - An Introduction
 
Classic vs. lightning
Classic vs. lightningClassic vs. lightning
Classic vs. lightning
 
Salesforce 101
Salesforce 101Salesforce 101
Salesforce 101
 
Pardot
PardotPardot
Pardot
 
Introduction to Lightning Web Component
Introduction to Lightning Web Component Introduction to Lightning Web Component
Introduction to Lightning Web Component
 
Lightning Web Component in Salesforce
Lightning Web Component in SalesforceLightning Web Component in Salesforce
Lightning Web Component in Salesforce
 
Deep Dive into OAuth for Connected Apps
Deep Dive into OAuth for Connected AppsDeep Dive into OAuth for Connected Apps
Deep Dive into OAuth for Connected Apps
 
Salesforce PPT.pptx
Salesforce PPT.pptxSalesforce PPT.pptx
Salesforce PPT.pptx
 
Automate All The Things with Flow
Automate All The Things with FlowAutomate All The Things with Flow
Automate All The Things with Flow
 
Lightning web components - Introduction, component Lifecycle, Events, decorat...
Lightning web components - Introduction, component Lifecycle, Events, decorat...Lightning web components - Introduction, component Lifecycle, Events, decorat...
Lightning web components - Introduction, component Lifecycle, Events, decorat...
 
Salesforce Service Cloud - An overview
Salesforce Service Cloud - An overviewSalesforce Service Cloud - An overview
Salesforce Service Cloud - An overview
 
Deep dive into Salesforce Connected App
Deep dive into Salesforce Connected AppDeep dive into Salesforce Connected App
Deep dive into Salesforce Connected App
 
Reports and dashboards @salesforce
Reports and dashboards @salesforceReports and dashboards @salesforce
Reports and dashboards @salesforce
 
Endless Use Cases with Salesforce Experience Cloud by Dar Veverka
Endless Use Cases with Salesforce Experience Cloud by Dar VeverkaEndless Use Cases with Salesforce Experience Cloud by Dar Veverka
Endless Use Cases with Salesforce Experience Cloud by Dar Veverka
 
CRM Salesforce Overview
CRM Salesforce OverviewCRM Salesforce Overview
CRM Salesforce Overview
 

Similar to OAuth Authorization flows in salesforce

CRM Science - Dreamforce '14: Using the Google SOAP API
CRM Science - Dreamforce '14: Using the Google SOAP APICRM Science - Dreamforce '14: Using the Google SOAP API
CRM Science - Dreamforce '14: Using the Google SOAP API
CRMScienceKirk
 
Authentication with OAuth and Connected Apps
Authentication with OAuth and Connected AppsAuthentication with OAuth and Connected Apps
Authentication with OAuth and Connected Apps
Salesforce Developers
 
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStoreDeveloping Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Salesforce Developers
 
Introduction to the Salesforce Mobile SDK for Android
Introduction to the Salesforce Mobile SDK for AndroidIntroduction to the Salesforce Mobile SDK for Android
Introduction to the Salesforce Mobile SDK for Android
Salesforce Developers
 
Introduction to the Salesforce.com Mobile SDK for iOS
Introduction to the Salesforce.com Mobile SDK for iOSIntroduction to the Salesforce.com Mobile SDK for iOS
Introduction to the Salesforce.com Mobile SDK for iOS
Salesforce Developers
 
How to Use Stormpath in angular js
How to Use Stormpath in angular jsHow to Use Stormpath in angular js
How to Use Stormpath in angular js
Stormpath
 
Introduction to Developing Android Apps With the Salesforce Mobile SDK
Introduction to Developing Android Apps With the Salesforce Mobile SDKIntroduction to Developing Android Apps With the Salesforce Mobile SDK
Introduction to Developing Android Apps With the Salesforce Mobile SDK
Salesforce Developers
 
SalesForce WebServices part 2
SalesForce WebServices part 2SalesForce WebServices part 2
SalesForce WebServices part 2
Mindfire Solutions
 
SharePoint Fest Chicago 2015 - Anatomy of configuring provider hosted add-in...
SharePoint Fest Chicago 2015  - Anatomy of configuring provider hosted add-in...SharePoint Fest Chicago 2015  - Anatomy of configuring provider hosted add-in...
SharePoint Fest Chicago 2015 - Anatomy of configuring provider hosted add-in...
Nik Patel
 
JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020
Matt Raible
 
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
Apigee | Google Cloud
 
SankethNM[2_10]
SankethNM[2_10]SankethNM[2_10]
SankethNM[2_10]
Sanketh Nm
 
How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST Framework
Katy Slemon
 
OpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for BeginnersOpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for Beginners
Salesforce Developers
 
Painless Mobile App Development Webinar
Painless Mobile App Development WebinarPainless Mobile App Development Webinar
Painless Mobile App Development Webinar
Salesforce Developers
 
RESTful Day 5
RESTful Day 5RESTful Day 5
RESTful Day 5
Akhil Mittal
 
Microsoft Graph API Delegated Permissions
Microsoft Graph API Delegated PermissionsMicrosoft Graph API Delegated Permissions
Microsoft Graph API Delegated Permissions
Stefan Weber
 
Connect Your Clouds with Force.com
Connect Your Clouds with Force.comConnect Your Clouds with Force.com
Connect Your Clouds with Force.com
Jeff Douglas
 
Web Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdfWeb Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdf
Infosec train
 
Web Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdfWeb Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdf
infosecTrain
 

Similar to OAuth Authorization flows in salesforce (20)

CRM Science - Dreamforce '14: Using the Google SOAP API
CRM Science - Dreamforce '14: Using the Google SOAP APICRM Science - Dreamforce '14: Using the Google SOAP API
CRM Science - Dreamforce '14: Using the Google SOAP API
 
Authentication with OAuth and Connected Apps
Authentication with OAuth and Connected AppsAuthentication with OAuth and Connected Apps
Authentication with OAuth and Connected Apps
 
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStoreDeveloping Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
Developing Offline-Capable Apps with the Salesforce Mobile SDK and SmartStore
 
Introduction to the Salesforce Mobile SDK for Android
Introduction to the Salesforce Mobile SDK for AndroidIntroduction to the Salesforce Mobile SDK for Android
Introduction to the Salesforce Mobile SDK for Android
 
Introduction to the Salesforce.com Mobile SDK for iOS
Introduction to the Salesforce.com Mobile SDK for iOSIntroduction to the Salesforce.com Mobile SDK for iOS
Introduction to the Salesforce.com Mobile SDK for iOS
 
How to Use Stormpath in angular js
How to Use Stormpath in angular jsHow to Use Stormpath in angular js
How to Use Stormpath in angular js
 
Introduction to Developing Android Apps With the Salesforce Mobile SDK
Introduction to Developing Android Apps With the Salesforce Mobile SDKIntroduction to Developing Android Apps With the Salesforce Mobile SDK
Introduction to Developing Android Apps With the Salesforce Mobile SDK
 
SalesForce WebServices part 2
SalesForce WebServices part 2SalesForce WebServices part 2
SalesForce WebServices part 2
 
SharePoint Fest Chicago 2015 - Anatomy of configuring provider hosted add-in...
SharePoint Fest Chicago 2015  - Anatomy of configuring provider hosted add-in...SharePoint Fest Chicago 2015  - Anatomy of configuring provider hosted add-in...
SharePoint Fest Chicago 2015 - Anatomy of configuring provider hosted add-in...
 
JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020JHipster and Okta - JHipster Virtual Meetup December 2020
JHipster and Okta - JHipster Virtual Meetup December 2020
 
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
I Love APIs 2015: Advanced Crash Course in Apigee Edge Workshop
 
SankethNM[2_10]
SankethNM[2_10]SankethNM[2_10]
SankethNM[2_10]
 
How to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST FrameworkHow to Implement Token Authentication Using the Django REST Framework
How to Implement Token Authentication Using the Django REST Framework
 
OpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for BeginnersOpenID Connect and Single Sign-On for Beginners
OpenID Connect and Single Sign-On for Beginners
 
Painless Mobile App Development Webinar
Painless Mobile App Development WebinarPainless Mobile App Development Webinar
Painless Mobile App Development Webinar
 
RESTful Day 5
RESTful Day 5RESTful Day 5
RESTful Day 5
 
Microsoft Graph API Delegated Permissions
Microsoft Graph API Delegated PermissionsMicrosoft Graph API Delegated Permissions
Microsoft Graph API Delegated Permissions
 
Connect Your Clouds with Force.com
Connect Your Clouds with Force.comConnect Your Clouds with Force.com
Connect Your Clouds with Force.com
 
Web Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdfWeb Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdf
 
Web Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdfWeb Application Penetration Testing Checklist.pdf
Web Application Penetration Testing Checklist.pdf
 

Recently uploaded

2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
Łukasz Chruściel
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Envertis Software Solutions
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
TheSMSPoint
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
Green Software Development
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
Ayan Halder
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
Alina Yurenko
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j
 

Recently uploaded (20)

2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf2024 eCommerceDays Toulouse - Sylius 2.0.pdf
2024 eCommerceDays Toulouse - Sylius 2.0.pdf
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise EditionWhy Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
Why Choose Odoo 17 Community & How it differs from Odoo 17 Enterprise Edition
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 
Transform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR SolutionsTransform Your Communication with Cloud-Based IVR Solutions
Transform Your Communication with Cloud-Based IVR Solutions
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, FactsALGIT - Assembly Line for Green IT - Numbers, Data, Facts
ALGIT - Assembly Line for Green IT - Numbers, Data, Facts
 
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Using Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional SafetyUsing Xen Hypervisor for Functional Safety
Using Xen Hypervisor for Functional Safety
 
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)GOING AOT WITH GRAALVM FOR  SPRING BOOT (SPRING IO)
GOING AOT WITH GRAALVM FOR SPRING BOOT (SPRING IO)
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit ParisNeo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
Neo4j - Product Vision and Knowledge Graphs - GraphSummit Paris
 

OAuth Authorization flows in salesforce

  • 1. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR Salesforce Developer Group Bengaluru, India @ SFDGBLR #SFDGBLR
  • 2. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR OAuth Authorization flows in Salesforce
  • 3. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR TABLE OF CONTENTS Connected App Creating Connected App and Managing Connected App Usage OAuth Web Server Flow Demo through Postman HTTP Client 01 03 02 04 05 OAuth JWT Bearer Token Flow What is JWT? Walkthrough with Postman HTTP Client OAuth JWT Bearer Token Flow in Apex Apex Code Walkthrough to connect one salesforce org to another using named credentials RESOURCES
  • 4. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR Connected App 01
  • 5. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR Connected App A connected app is a framework that enables an external application to integrate with Salesforce using APIs and standard protocols, such as SAML, OAuth, and OpenID Connect. Connected apps use these protocols to authenticate, authorize, and provide single sign-on (SSO) for external apps.
  • 6. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR 1. Creating Connected App 2. Managing Connected App Usage and Policies. DEMO
  • 7. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR OAuth Web server flow 02
  • 8. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR OAuth Web server flow 1. The external web service—via the connected app—posts an authorization code request using the authorization code grant type to the Salesforce authorization endpoint. 2. With an authorization code, the connected app can prove that it’s been authorized as a safe visitor to the site and that it has permission to request an access token.
  • 9. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR 1. OAuth Web server flow walkthrough with Postman HTTP Client. DEMO
  • 10. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR 1. https://login.salesforce.com/services/oauth2/autho rize?client_id=xxx&redirect_uri=https://login.sale sforce.com/oauth2/callback&response_type=code 2. Endpoint for access token: https://login.salesforce.com/services/oauth2/token POST /services/oauth2/token,Content-type: application/x-www-form- urlencoded,grant_type=authorization_code&code=from step1(url decoded)&client_id=xxx&client_secret=xxx&redirect_ uri=https://login.salesforce.com/oauth2/callback Steps Involved in Web Server Flow
  • 11. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR OAuth JWT Bearer Token flow 03
  • 12. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR OAuth JWT Bearer Token flow 1. This is used for server to server integration scenarios. 2. 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. Please note this flows never issues a refresh token.
  • 13. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR JWT Structure Header -{"alg":"RS256"} Payload (This contains claims information which is an object containing information about user and additional data.Claims are set using parameters-"Iss,aud,sub,exp") Signature <headerbase64encodedurl>.<claimsbase64encodedclai ms>.<signature(uses algorithm like RS 256)>
  • 14. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR 1. OAuth JWT Bearer Token flow walkthrough with Postman HTTP Client. DEMO
  • 15. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR POST /services/oauth2/token HTTP/1.1 Content-Type: application/x-www-form-urlencoded grant_type= urn:ietf:params:oauth:grant-type:jwt- bearer&assertion=JWT token generated in JWT.io Website Steps to be followed in Postman
  • 16. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR OAuth JWT Bearer Token flow Usage in Apex 04
  • 17. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR 1. OAuth JWT Bearer Token flow (Apex code walkthrough to integrate one salesforce org to another using named credentials) DEMO
  • 18. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR Auth.JWT jwt = new Auth.JWT(); jwt.setSub('debarunsengupta2512@live.com'); jwt.setAud('https://login.salesforce.com'); jwt.setIss('connected app client id');Auth.JWS jws = new Auth.JWS(jwt,’Certificate keystore name’);String token = jws.getCompactSerialization();String tokenEndpoint = 'https://login.salesforce.com/services/oauth2/token';//POST the JWT bearer token Auth.JWTBearerTokenExchange bearer = new Auth.JWTBearerTokenExchange(tokenEndpoint, jws); //Get the access token String accessToken = bearer.getAccessToken(); system.debug('Access Token-->'+accessToken); Apex Code without Named Credentials
  • 19. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR String service_limits='/services/data/v48.0/sobjects/Account/listviews/'; HttpRequest req = new HttpRequest(); req.setEndpoint('callout:JWT_Demo'+service_limits); req.setMethod('GET'); Http http = new Http(); HTTPResponse res = http.send(req); System.debug(res.getBody()); System.debug(res.getstatuscode()); Apex Code with Named Credentials
  • 20. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR Resources 05
  • 21. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR 1. https://help.salesforce.com/articleView?id=remoteaccess_oauth_jwt_flow.htm&type=5 2. https://jwt.io/ 3. https://developer.salesforce.com/docs/atlas.en- us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_key_and_cert.htm 4. https://www.base64encode.org/ 5. https://www.freeformatter.com/json-formatter.html#ad-output 6. https://www.unixtimestamp.com/ Some Useful commands to convert .crt to keystore to store in SFDC openssl pkcs12 -export -in server.crt -inkey server.pem -out testkeystore.p12 keytool -importkeystore -srckeystore testkeystore.p12 -srcstoretype pkcs12 -destkeystore servercert.jks -deststoretype JKS keytool -keystore /<Path>/servercert.jks -changealias -alias 1 -destalias salesforcetest
  • 22. Salesforce Developer Group Bengaluru, India - @SFDGBLR #SFDGBLR CREDITS: This presentation template was created by Slidesgo, including icons by Flaticon, and infographics & images by Freepik. Please keep this slide for attribution.