SlideShare una empresa de Scribd logo
1 de 27
Descargar para leer sin conexión
Authentication with OAuth and
Connected Apps
Best Practice API Authentication
Chuck Mortimore, salesforce.com, Sr. Director of Product Management
@cmort
Safe Harbor
 Safe harbor statement under the Private Securities Litigation Reform Act of 1995:

 This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
 materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results
 expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be
 deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other
 financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
 statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.

 The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new
 functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our
 operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of
 intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we
 operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new
 releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization
 and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of
 salesforce.com, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This
 documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of
 our Web site.

 Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently
 available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based
 upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-
 looking statements.
Why OAuth?
 Open: A standard protocol that enables secure API access


 Simple: No need to write UI or handle SSO/2-Factor/etc.


 Mobile: Mobile Policies, No API Tokens, IP Bypass, etc.


 Secure: Gets rid of passwords in Apps. Strong crypto options
The World’s Simplest
OAuth Client
Step 1: Register your App
Step 2: Craft a URL to the Authorize Service


 https://login.salesforce.com/services/oauth2/authorize
 ?response_type=code
 &client_id={YOUR_CLIENT_ID}
 &redirect_uri={YOUR_URL_ENCODED_REDIRECT_URI}
Step 3: Exchange the Code

 curl -d
   'grant_type=authorization_code&client_id={CLIENT_ID}&clie
   nt_secret={CLIENT_SECRET}&redirect_uri={YOUR_URL_E
   NCODED_REDIRECT_URI}&authorization_code={CODE}'
   https://login.salesforce.com/services/oauth2/token
Step 4: You’re Done - Use your token!


  GET /resource HTTP/1.1
  Host: na1.salesforce.com
  Authorization: Bearer czZCaGRSa3F0MzpnWDFmQm….


  curl -L -H 'Authorization: Bearer {ACCESS_TOKEN}' -H "X-
  PrettyPrint: true" {RESOURCE}
Let’s Build a Web App
Code Flow: How does it work?

1) App Redirects User to
   Authorization Services where
   User is Authenticated and
   Authorizes App
2) Code Returned to App
3) App Exchanges Code at Token
   Service
Let’s Build a Web App




https://github.com/cmortimore/df12web
Let’s Build a Mobile App
Token Flow How does it work?

1) App Redirects User to
   Authorization Services where
   User is Authenticated and
   Authorizes App
2) Token Response returned
   directly to app on URL behind a
   # fragment
What happens on Mobile?

1) Device opens a browser with
   authorization URL


1) Tokens returned on URL behind
   # fragment – instrumented
   browser is monitoring and
   parses URL
What the User Sees:




             Authentication   Authorization
Codified Best Practice: Mobile SDK & Container




   NATIVE                                     HYBRID                                    WEB




            OAuth2.0                             Secure Storage                     Mobile Login
            Standard authentication              Securely store credentials and     User experience, processes and
            implementation providing single      business sensitive data with       policy control optimized for the
            sign-on for trusted apps             enterprise-class reliability and   mobile environment
                                                 security
http://developer.force.com/mobilesdk
Let’s build a Web App




https://github.com/cmortimore/df12mobile
Notice SSO works! Refresh Tokens

 It’s a lot like a password
   Allows you to get more sessions
   Make sure you treat it like one!


                POST /services/oauth2/token HTTP/1.1
                Host: login.salesforce.com
                Content-Type: application/x-www-form-urlencoded


                grant_type=refresh_token
                &refresh_token=5Aep8615VRsd_GrUz3LAcJl
                &client_id=MyApp
                &redirect_uri=myapp%3A%2F%2Fcallback
Let’s Build an Integration App
What if I just want to call server to server

 Uid / Password Flow
    - Simple, but uses passwords, API tokens, etc.


 Web SSO Assertion Flow
    - Reuse SAML SSO and existing Trust


 SAML/JWT Assertion Flow
    - Cert and Trust Specific to the App
Let’s Build a Web App




https://github.com/cmortimore/df12integration
Enterprise Class Authorization
with Connected Apps
Admin Authorization for OAuth Apps

1) Admin “installs” app


2) App Uses any OAuth Flow


3) User Authorization is evaluated
   via Admin settings
Final Thoughts

 No one likes plumbing….use a toolkit


 Make your login URLs configurable
    login.salesforce.com, test.salesforce.com, other


 Protect against attacks
    Set a cookie, and check for it on response
Chuck Mortimore
    @cmort
Authentication with OAuth and Connected Apps

Más contenido relacionado

La actualidad más candente

Integration using Salesforce Canvas
Integration using Salesforce CanvasIntegration using Salesforce Canvas
Integration using Salesforce CanvasDhanik Sahni
 
Secure Salesforce: Org Access Controls
Secure Salesforce: Org Access ControlsSecure Salesforce: Org Access Controls
Secure Salesforce: Org Access ControlsSalesforce Developers
 
Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Mark Adcock
 
Easy REST Integrations with Lightning Components and Salesforce1
Easy REST Integrations with Lightning Components and Salesforce1Easy REST Integrations with Lightning Components and Salesforce1
Easy REST Integrations with Lightning Components and Salesforce1Salesforce Developers
 
Salesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewSalesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewDhanik Sahni
 
Secure Salesforce: Code Scanning with Checkmarx
Secure Salesforce: Code Scanning with CheckmarxSecure Salesforce: Code Scanning with Checkmarx
Secure Salesforce: Code Scanning with CheckmarxSalesforce Developers
 
Secure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and SharingSecure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and SharingSalesforce Developers
 
Deep dive into Salesforce Connected App
Deep dive into Salesforce Connected AppDeep dive into Salesforce Connected App
Deep dive into Salesforce Connected AppDhanik Sahni
 
How Force.com developers do more in less time
How Force.com developers do more in less timeHow Force.com developers do more in less time
How Force.com developers do more in less timeAbhinav Gupta
 
Seamless Authentication with Force.com Canvas
Seamless Authentication with Force.com CanvasSeamless Authentication with Force.com Canvas
Seamless Authentication with Force.com CanvasSalesforce Developers
 
Build Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForceBuild Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForcevraopolisetti
 
Lightning Out: Components for the Rest of the World
Lightning Out: Components for the Rest of the WorldLightning Out: Components for the Rest of the World
Lightning Out: Components for the Rest of the WorldSalesforce Developers
 
2. 8 things that will make your business love your developers again
2. 8 things that will make your business love your developers again2. 8 things that will make your business love your developers again
2. 8 things that will make your business love your developers againEuroCloud
 
Migrating Visualforce Pages to Lightning
Migrating Visualforce Pages to LightningMigrating Visualforce Pages to Lightning
Migrating Visualforce Pages to LightningSalesforce Developers
 
Salesforce Identity: Don't Treat Your Customers Like Your Employees
Salesforce Identity: Don't Treat Your Customers Like Your EmployeesSalesforce Identity: Don't Treat Your Customers Like Your Employees
Salesforce Identity: Don't Treat Your Customers Like Your EmployeesSalesforce Developers
 
Building an SSO platform in php (Zendcon 2010)
Building an SSO platform in php (Zendcon 2010)Building an SSO platform in php (Zendcon 2010)
Building an SSO platform in php (Zendcon 2010)Ivo Jansch
 
Secure Salesforce: CRUD / FLS / Sharing
Secure Salesforce: CRUD / FLS / SharingSecure Salesforce: CRUD / FLS / Sharing
Secure Salesforce: CRUD / FLS / SharingSalesforce Developers
 

La actualidad más candente (20)

Integration using Salesforce Canvas
Integration using Salesforce CanvasIntegration using Salesforce Canvas
Integration using Salesforce Canvas
 
Secure Salesforce: Org Access Controls
Secure Salesforce: Org Access ControlsSecure Salesforce: Org Access Controls
Secure Salesforce: Org Access Controls
 
Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3
 
Easy REST Integrations with Lightning Components and Salesforce1
Easy REST Integrations with Lightning Components and Salesforce1Easy REST Integrations with Lightning Components and Salesforce1
Easy REST Integrations with Lightning Components and Salesforce1
 
Iam f42 a
Iam f42 aIam f42 a
Iam f42 a
 
Salesforce Integration Pattern Overview
Salesforce Integration Pattern OverviewSalesforce Integration Pattern Overview
Salesforce Integration Pattern Overview
 
Introducing Salesforce Identity
Introducing Salesforce IdentityIntroducing Salesforce Identity
Introducing Salesforce Identity
 
Secure Salesforce: Code Scanning with Checkmarx
Secure Salesforce: Code Scanning with CheckmarxSecure Salesforce: Code Scanning with Checkmarx
Secure Salesforce: Code Scanning with Checkmarx
 
Secure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and SharingSecure Coding: Field-level Security, CRUD, and Sharing
Secure Coding: Field-level Security, CRUD, and Sharing
 
Deep dive into Salesforce Connected App
Deep dive into Salesforce Connected AppDeep dive into Salesforce Connected App
Deep dive into Salesforce Connected App
 
How Force.com developers do more in less time
How Force.com developers do more in less timeHow Force.com developers do more in less time
How Force.com developers do more in less time
 
Single Sign-On Best Practices
Single Sign-On Best PracticesSingle Sign-On Best Practices
Single Sign-On Best Practices
 
Seamless Authentication with Force.com Canvas
Seamless Authentication with Force.com CanvasSeamless Authentication with Force.com Canvas
Seamless Authentication with Force.com Canvas
 
Build Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForceBuild Amazing Website without coding using Salesforce SiteForce
Build Amazing Website without coding using Salesforce SiteForce
 
Lightning Out: Components for the Rest of the World
Lightning Out: Components for the Rest of the WorldLightning Out: Components for the Rest of the World
Lightning Out: Components for the Rest of the World
 
2. 8 things that will make your business love your developers again
2. 8 things that will make your business love your developers again2. 8 things that will make your business love your developers again
2. 8 things that will make your business love your developers again
 
Migrating Visualforce Pages to Lightning
Migrating Visualforce Pages to LightningMigrating Visualforce Pages to Lightning
Migrating Visualforce Pages to Lightning
 
Salesforce Identity: Don't Treat Your Customers Like Your Employees
Salesforce Identity: Don't Treat Your Customers Like Your EmployeesSalesforce Identity: Don't Treat Your Customers Like Your Employees
Salesforce Identity: Don't Treat Your Customers Like Your Employees
 
Building an SSO platform in php (Zendcon 2010)
Building an SSO platform in php (Zendcon 2010)Building an SSO platform in php (Zendcon 2010)
Building an SSO platform in php (Zendcon 2010)
 
Secure Salesforce: CRUD / FLS / Sharing
Secure Salesforce: CRUD / FLS / SharingSecure Salesforce: CRUD / FLS / Sharing
Secure Salesforce: CRUD / FLS / Sharing
 

Similar a Authentication with OAuth and Connected Apps

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 iOSSalesforce Developers
 
What’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & ComplianceWhat’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & ComplianceShesh Kondi
 
What’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & ComplianceWhat’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & ComplianceShesh Kondi
 
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 AndroidSalesforce Developers
 
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 BeginnersSalesforce Developers
 
Mobile SSO: Give App Users a Break from Typing Passwords
Mobile SSO: Give App Users a Break from Typing PasswordsMobile SSO: Give App Users a Break from Typing Passwords
Mobile SSO: Give App Users a Break from Typing PasswordsCA API Management
 
CloudOps evening presentation from Salesforce.com
CloudOps evening presentation from Salesforce.comCloudOps evening presentation from Salesforce.com
CloudOps evening presentation from Salesforce.comAlistair Croll
 
OpenID Connect: The new standard for connecting to your Customers, Partners, ...
OpenID Connect: The new standard for connecting to your Customers, Partners, ...OpenID Connect: The new standard for connecting to your Customers, Partners, ...
OpenID Connect: The new standard for connecting to your Customers, Partners, ...Salesforce Developers
 
04 june meetup - An overview of OAuth2 on Force.com projects
04   june meetup - An overview of OAuth2 on Force.com projects04   june meetup - An overview of OAuth2 on Force.com projects
04 june meetup - An overview of OAuth2 on Force.com projectsAldo Fernandez
 
[MBF2] Plate-forme Salesforce par Peter Chittum
[MBF2] Plate-forme Salesforce par Peter Chittum[MBF2] Plate-forme Salesforce par Peter Chittum
[MBF2] Plate-forme Salesforce par Peter ChittumBeMyApp
 
Salesforce Identity Management
Salesforce Identity ManagementSalesforce Identity Management
Salesforce Identity ManagementJayant Jindal
 
Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15
Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15
Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15Paris Salesforce Developer Group
 
Developers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 PlatformDevelopers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 PlatformJohn Stevenson
 
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 minsBuild Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 minsKashi Ahmed
 
Modev presentation
Modev presentationModev presentation
Modev presentationRyan Upton
 
Developer Tour on the Salesforce1 Platform
Developer Tour on the Salesforce1 PlatformDeveloper Tour on the Salesforce1 Platform
Developer Tour on the Salesforce1 PlatformSalesforce Deutschland
 
Taking Identity from the Enterprise to the Cloud
Taking Identity from the Enterprise to the CloudTaking Identity from the Enterprise to the Cloud
Taking Identity from the Enterprise to the CloudPat Patterson
 
Real Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsReal Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsSalesforce 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 SmartStoreSalesforce Developers
 
Boxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too MuchBoxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too MuchPeter Chittum
 

Similar a Authentication with OAuth and Connected Apps (20)

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
 
What’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & ComplianceWhat’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & Compliance
 
What’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & ComplianceWhat’s new in summer’15 release - Security & Compliance
What’s new in summer’15 release - Security & Compliance
 
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
 
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
 
Mobile SSO: Give App Users a Break from Typing Passwords
Mobile SSO: Give App Users a Break from Typing PasswordsMobile SSO: Give App Users a Break from Typing Passwords
Mobile SSO: Give App Users a Break from Typing Passwords
 
CloudOps evening presentation from Salesforce.com
CloudOps evening presentation from Salesforce.comCloudOps evening presentation from Salesforce.com
CloudOps evening presentation from Salesforce.com
 
OpenID Connect: The new standard for connecting to your Customers, Partners, ...
OpenID Connect: The new standard for connecting to your Customers, Partners, ...OpenID Connect: The new standard for connecting to your Customers, Partners, ...
OpenID Connect: The new standard for connecting to your Customers, Partners, ...
 
04 june meetup - An overview of OAuth2 on Force.com projects
04   june meetup - An overview of OAuth2 on Force.com projects04   june meetup - An overview of OAuth2 on Force.com projects
04 june meetup - An overview of OAuth2 on Force.com projects
 
[MBF2] Plate-forme Salesforce par Peter Chittum
[MBF2] Plate-forme Salesforce par Peter Chittum[MBF2] Plate-forme Salesforce par Peter Chittum
[MBF2] Plate-forme Salesforce par Peter Chittum
 
Salesforce Identity Management
Salesforce Identity ManagementSalesforce Identity Management
Salesforce Identity Management
 
Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15
Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15
Introducing salesforce shield - Paris Salesforce Developer Group - Oct 15
 
Developers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 PlatformDevelopers guide to the Salesforce1 Platform
Developers guide to the Salesforce1 Platform
 
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 minsBuild Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
Build Cloud & Mobile App on Salesforce Force.com Platform in 15 mins
 
Modev presentation
Modev presentationModev presentation
Modev presentation
 
Developer Tour on the Salesforce1 Platform
Developer Tour on the Salesforce1 PlatformDeveloper Tour on the Salesforce1 Platform
Developer Tour on the Salesforce1 Platform
 
Taking Identity from the Enterprise to the Cloud
Taking Identity from the Enterprise to the CloudTaking Identity from the Enterprise to the Cloud
Taking Identity from the Enterprise to the Cloud
 
Real Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform EventsReal Time Integration with Salesforce Platform Events
Real Time Integration with Salesforce Platform Events
 
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
 
Boxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too MuchBoxcars and Cabooses: When One More XHR Is Too Much
Boxcars and Cabooses: When One More XHR Is Too Much
 

Más de Salesforce Developers

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSalesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceSalesforce Developers
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base ComponentsSalesforce Developers
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsSalesforce Developers
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaSalesforce Developers
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentSalesforce Developers
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsSalesforce Developers
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsSalesforce Developers
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsSalesforce Developers
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and TestingSalesforce Developers
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilitySalesforce Developers
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce dataSalesforce Developers
 
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 IntroductionSalesforce Developers
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPSalesforce Developers
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceSalesforce Developers
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureSalesforce Developers
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DXSalesforce Developers
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectSalesforce Developers
 

Más de Salesforce Developers (20)

Sample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce DevelopersSample Gallery: Reference Code and Best Practices for Salesforce Developers
Sample Gallery: Reference Code and Best Practices for Salesforce Developers
 
Maximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component PerformanceMaximizing Salesforce Lightning Experience and Lightning Component Performance
Maximizing Salesforce Lightning Experience and Lightning Component Performance
 
Local development with Open Source Base Components
Local development with Open Source Base ComponentsLocal development with Open Source Base Components
Local development with Open Source Base Components
 
TrailheaDX India : Developer Highlights
TrailheaDX India : Developer HighlightsTrailheaDX India : Developer Highlights
TrailheaDX India : Developer Highlights
 
Why developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX IndiaWhy developers shouldn’t miss TrailheaDX India
Why developers shouldn’t miss TrailheaDX India
 
CodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local DevelopmentCodeLive: Build Lightning Web Components faster with Local Development
CodeLive: Build Lightning Web Components faster with Local Development
 
CodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web ComponentsCodeLive: Converting Aura Components to Lightning Web Components
CodeLive: Converting Aura Components to Lightning Web Components
 
Enterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web ComponentsEnterprise-grade UI with open source Lightning Web Components
Enterprise-grade UI with open source Lightning Web Components
 
TrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer HighlightsTrailheaDX and Summer '19: Developer Highlights
TrailheaDX and Summer '19: Developer Highlights
 
Live coding with LWC
Live coding with LWCLive coding with LWC
Live coding with LWC
 
Lightning web components - Episode 4 : Security and Testing
Lightning web components  - Episode 4 : Security and TestingLightning web components  - Episode 4 : Security and Testing
Lightning web components - Episode 4 : Security and Testing
 
LWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura InteroperabilityLWC Episode 3- Component Communication and Aura Interoperability
LWC Episode 3- Component Communication and Aura Interoperability
 
Lightning web components episode 2- work with salesforce data
Lightning web components   episode 2- work with salesforce dataLightning web components   episode 2- work with salesforce data
Lightning web components episode 2- work with salesforce data
 
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
 
Migrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCPMigrating CPQ to Advanced Calculator and JSQCP
Migrating CPQ to Advanced Calculator and JSQCP
 
Scale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in SalesforceScale with Large Data Volumes and Big Objects in Salesforce
Scale with Large Data Volumes and Big Objects in Salesforce
 
Replicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data CaptureReplicate Salesforce Data in Real Time with Change Data Capture
Replicate Salesforce Data in Real Time with Change Data Capture
 
Modern Development with Salesforce DX
Modern Development with Salesforce DXModern Development with Salesforce DX
Modern Development with Salesforce DX
 
Get Into Lightning Flow Development
Get Into Lightning Flow DevelopmentGet Into Lightning Flow Development
Get Into Lightning Flow Development
 
Integrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS ConnectIntegrate CMS Content Into Lightning Communities with CMS Connect
Integrate CMS Content Into Lightning Communities with CMS Connect
 

Authentication with OAuth and Connected Apps

  • 1. Authentication with OAuth and Connected Apps Best Practice API Authentication Chuck Mortimore, salesforce.com, Sr. Director of Product Management @cmort
  • 2. Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other litigation, risks associated with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward- looking statements.
  • 3. Why OAuth? Open: A standard protocol that enables secure API access Simple: No need to write UI or handle SSO/2-Factor/etc. Mobile: Mobile Policies, No API Tokens, IP Bypass, etc. Secure: Gets rid of passwords in Apps. Strong crypto options
  • 5. Step 1: Register your App
  • 6. Step 2: Craft a URL to the Authorize Service https://login.salesforce.com/services/oauth2/authorize ?response_type=code &client_id={YOUR_CLIENT_ID} &redirect_uri={YOUR_URL_ENCODED_REDIRECT_URI}
  • 7. Step 3: Exchange the Code curl -d 'grant_type=authorization_code&client_id={CLIENT_ID}&clie nt_secret={CLIENT_SECRET}&redirect_uri={YOUR_URL_E NCODED_REDIRECT_URI}&authorization_code={CODE}' https://login.salesforce.com/services/oauth2/token
  • 8. Step 4: You’re Done - Use your token! GET /resource HTTP/1.1 Host: na1.salesforce.com Authorization: Bearer czZCaGRSa3F0MzpnWDFmQm…. curl -L -H 'Authorization: Bearer {ACCESS_TOKEN}' -H "X- PrettyPrint: true" {RESOURCE}
  • 9. Let’s Build a Web App
  • 10. Code Flow: How does it work? 1) App Redirects User to Authorization Services where User is Authenticated and Authorizes App 2) Code Returned to App 3) App Exchanges Code at Token Service
  • 11. Let’s Build a Web App https://github.com/cmortimore/df12web
  • 12. Let’s Build a Mobile App
  • 13. Token Flow How does it work? 1) App Redirects User to Authorization Services where User is Authenticated and Authorizes App 2) Token Response returned directly to app on URL behind a # fragment
  • 14. What happens on Mobile? 1) Device opens a browser with authorization URL 1) Tokens returned on URL behind # fragment – instrumented browser is monitoring and parses URL
  • 15. What the User Sees: Authentication Authorization
  • 16. Codified Best Practice: Mobile SDK & Container NATIVE HYBRID WEB OAuth2.0 Secure Storage Mobile Login Standard authentication Securely store credentials and User experience, processes and implementation providing single business sensitive data with policy control optimized for the sign-on for trusted apps enterprise-class reliability and mobile environment security
  • 18. Let’s build a Web App https://github.com/cmortimore/df12mobile
  • 19. Notice SSO works! Refresh Tokens It’s a lot like a password  Allows you to get more sessions  Make sure you treat it like one! POST /services/oauth2/token HTTP/1.1 Host: login.salesforce.com Content-Type: application/x-www-form-urlencoded grant_type=refresh_token &refresh_token=5Aep8615VRsd_GrUz3LAcJl &client_id=MyApp &redirect_uri=myapp%3A%2F%2Fcallback
  • 20. Let’s Build an Integration App
  • 21. What if I just want to call server to server Uid / Password Flow - Simple, but uses passwords, API tokens, etc. Web SSO Assertion Flow - Reuse SAML SSO and existing Trust SAML/JWT Assertion Flow - Cert and Trust Specific to the App
  • 22. Let’s Build a Web App https://github.com/cmortimore/df12integration
  • 24. Admin Authorization for OAuth Apps 1) Admin “installs” app 2) App Uses any OAuth Flow 3) User Authorization is evaluated via Admin settings
  • 25. Final Thoughts No one likes plumbing….use a toolkit Make your login URLs configurable login.salesforce.com, test.salesforce.com, other Protect against attacks Set a cookie, and check for it on response
  • 26. Chuck Mortimore @cmort