SlideShare a Scribd company logo
OAuth2 Primer
Manish Pandit
03/19/2018
OAuth2 primer
OAuth2 primer
OAuth2 primer
OAuth Primer
The Need
OAuth as a Standard
OAuth in Practice
Identity and Authorization
I want TurboTax to pull my trades from Fidelity
But...
I do not want to give my Fidelity password to TurboTax
I do not want TurboTax to pull anything other than trades
I want the ability to revoke TurboTax’s access to my Fidelity Account
So..
Access Keys
Whitelisting
HTTP Basic
Screen Scraping with stored credentials
Wide open access/No authorization
And there is more..
Mobile
IoT Devices
Service to Service
Client-Server Applications
Rich Client Applications
Need for..
A secure standard for access authorization without the password leaving the site
where the protected data is.
Short-lived tokens in lieu of passwords to access information.
A standard that works across all the API access patterns.
OAuth2 primer
OAuth 2.0
OAuth is an open standard for access delegation, commonly used as a way for
Internet users to grant websites or applications access to their information on
other websites but without giving them the passwords. (Wikipedia)
OAuth 2.0 relies on HTTP over TLS
OAuth is an authorization protocol, and NOT an authentication protocol.
* I still have bad dreams about OAuth 1.0 and 1.0a
..and many, many more!
Coming soon..
Terminology
The OAuth spec outlines the basic terms that build upon the standard.
● Resource Owner
● Resource Server
● Client
● Authorization Server
Connecting the dots
Resource Owner is the user whose resources (data) exists on a Resource
Server. The Resource Owner grants access to a Client to access these resources,
by authorizing access to those resources on an Authorization Server where his
identity exists and can be authenticated.
The Client then gets credentials from the Authorization Server that can be
used on the Resource Owner’s behalf to access the resources on the Resource
Server.
Authorization Examples
A Twitter desktop client posting tweets on your behalf
MyFitnessPal getting your Step Count from your Fitbit Account
Turbotax getting your trades from your Fidelity Account
Instacart Servers calling Marqeta’s API
Facebook iOS app accessing your Facebook account
Single Page App (RCA) accessing your News Aggregator
OAuth 2.0 Constructs
Client ID
Client Secret
Scope
Grant Type
Access Token
Refresh Token
Client ID and Client Secret
Identify the client which could be an web application, a single page app, a native
mobile app, or a server
Grant Type
Steps that define the authorization protocol, resulting in an access token.
Access Tokens
Short lived (hours, days, weeks, months?), bearer tokens that the client can use
to act on behalf of the resource owner.
Refresh Tokens
Long lived tokens, used to request a new access token upon expiry of the
current one, without Resource Owner intervention.
Scope
Scopes define the which resources can be accessed by the client using the access
token. Scopes can be sliced and diced in many ways - Read vs. Write,
Functionality based, Default, etc.
Be careful defining them - you’ll end up with an LDAP ACLs.
Scopes <> ACL.
Authorization Code Grant
For client/server web applications, also known as delegated authentication.
Also known as 3-legged OAuth.
Quiz - Guess the 3 legs
Authorization Code Grant Flow
1. The client redirects the resource owner to the authorization server by passing in the
response_type=code, redirect_uri, scope, and client_id.
2. The authorization server asks the resource owner for his credentials, MFA may be
performed here.
3. The authorization server asks the resource owner to pick scopes that the client will
be authorized for.
4. Upon the resource owner granting access, the authorization server sends a short
lived authorization code to the redirect_uri
5. The client uses this authorization code to do a POST on the authorization server,
passing in client_id, client_secret, and grant_type=authorization_code.
6. The client receives a refresh token and and access token.
Demo – CapitalOne Rewards
Implicit Grant
For Single Page Apps, or Desktop Clients, or Browser Extensions..
There is no client_secret since the client cannot keep the secret.
A simplified version of Authorization Code Grant.
A refresh token is not returned in the response.
Never, ever used in Financial Systems.
Implicit Grant Flow
1. Client redirects the resource owner to the authorization URL same as
Authorization Code Flow, except response_type is token (vs. code), and
grant_type is not passed.
2. Upon the access being granted by the resource owner, an Access Token is
provided to the client.
Resource Owner Password Grant
For fully trusted clients, like Native Mobile Apps provided by the Resource
Server who is also the Identity Server.
The only grant type where a user’s credentials are passed in the token request.
Also known as Password Grant
Resource Owner Password Grant Flow
1. Client sends request to the Authorization server as a POST with
grant_type=password, client_id, client_secret, scope, username, and
password.
2. The Authorization Server responds with an access token and a refresh
token.
Client Credentials Grant
For server to service, or machine to machine, or service to service call. There is
no identity involved.
Also known as 2-legged OAuth.
A refresh token is not returned.
Simplest of all grant types.
Additional security via whitelisting and firewalling can be implemented.
Client Credentials Grant Flow
1. Client sends a POST request to the authorization server with client_id,
client_secret, grant_type=client_credentials and scope.
2. Authorization server returns an access token to the client.
Demo – CapitalOne Credit Offers
Source: https://auth0.com/docs/api-auth/which-oauth-flow-to-use
References
The OAuth2 Spec, RFC 6749 https://tools.ietf.org/html/rfc6749
The OAuth Bible http://oauthbible.com/
A Guide to OAuth2 Grant Types https://alexbilbie.com/guide-to-oauth-2-grants/

More Related Content

PDF
Introduction to OAuth2.0
PPTX
An introduction to OAuth 2
PPTX
The State of OAuth2
PDF
Security for oauth 2.0 - @topavankumarj
PDF
Spring security oauth2
PPTX
OAuth2 Presentaion
PPTX
OAuth2 & OpenID Connect
PPTX
OAuth 2
Introduction to OAuth2.0
An introduction to OAuth 2
The State of OAuth2
Security for oauth 2.0 - @topavankumarj
Spring security oauth2
OAuth2 Presentaion
OAuth2 & OpenID Connect
OAuth 2

What's hot (20)

ODP
OAuth2 - Introduction
PPT
OAuth2 Protocol with Grails Spring Security
PPTX
An Introduction to OAuth 2
PDF
Demystifying OAuth 2.0
PPTX
OAuth2 + API Security
PDF
OAuth 2.0
PDF
Stateless Auth using OAuth2 & JWT
PDF
Implementing OAuth
PDF
Intro to API Security with Oauth 2.0
PDF
OAuth - Open API Authentication
PPTX
An Introduction to OAuth2
PPTX
Securing your APIs with OAuth, OpenID, and OpenID Connect
PPTX
PPTX
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
PPTX
(1) OAuth 2.0 Overview
PPT
Silicon Valley Code Camp 2009: OAuth: What, Why and How
PPTX
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
PPTX
Oauth2 and OWSM OAuth2 support
PPTX
Securing RESTful APIs using OAuth 2 and OpenID Connect
PPTX
OAuth 2 Presentation
OAuth2 - Introduction
OAuth2 Protocol with Grails Spring Security
An Introduction to OAuth 2
Demystifying OAuth 2.0
OAuth2 + API Security
OAuth 2.0
Stateless Auth using OAuth2 & JWT
Implementing OAuth
Intro to API Security with Oauth 2.0
OAuth - Open API Authentication
An Introduction to OAuth2
Securing your APIs with OAuth, OpenID, and OpenID Connect
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
(1) OAuth 2.0 Overview
Silicon Valley Code Camp 2009: OAuth: What, Why and How
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Oauth2 and OWSM OAuth2 support
Securing RESTful APIs using OAuth 2 and OpenID Connect
OAuth 2 Presentation
Ad

Similar to OAuth2 primer (20)

PPTX
Intro to OAuth2 and OpenID Connect
PDF
Keeping Pace with OAuth’s Evolving Security Practices.pdf
PDF
OAuth 2.0 Misconceptions
PPTX
Extended Security with WSO2 API Management Platform
PDF
Lecture #25 : Oauth 2.0
PPTX
PPTX
Devteach 2017 OAuth and Open id connect demystified
PPTX
OAuth2 Implementation Presentation (Java)
PDF
OAuth2
PDF
Demystifying OAuth 2.0
PDF
ConFoo 2015 - Securing RESTful resources with OAuth2
PDF
Stateless Auth using OAUTH2 & JWT
PPTX
O auth 2.0 authorization framework
PPTX
OAuth
PDF
Stateless authentication for microservices applications - JavaLand 2015
PDF
Stateless authentication for microservices
PDF
Oauth2.0 tutorial
PDF
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
PPTX
Ladies Be Architects - Study Group III: OAuth 2.0 (Ep 1)
PDF
O auth2.0 guide
Intro to OAuth2 and OpenID Connect
Keeping Pace with OAuth’s Evolving Security Practices.pdf
OAuth 2.0 Misconceptions
Extended Security with WSO2 API Management Platform
Lecture #25 : Oauth 2.0
Devteach 2017 OAuth and Open id connect demystified
OAuth2 Implementation Presentation (Java)
OAuth2
Demystifying OAuth 2.0
ConFoo 2015 - Securing RESTful resources with OAuth2
Stateless Auth using OAUTH2 & JWT
O auth 2.0 authorization framework
OAuth
Stateless authentication for microservices applications - JavaLand 2015
Stateless authentication for microservices
Oauth2.0 tutorial
Stateless authentication with OAuth 2 and JWT - JavaZone 2015
Ladies Be Architects - Study Group III: OAuth 2.0 (Ep 1)
O auth2.0 guide
Ad

More from Manish Pandit (20)

PDF
Disaster recovery - What, Why, and How
PDF
Serverless Architectures on AWS in practice - OSCON 2018
PDF
Disaster Recovery and Reliability
PDF
Immutable AWS Deployments with Packer and Jenkins
PDF
AWS Lambda with Serverless Framework and Java
PDF
AWS Primer and Quickstart
PDF
Silicon Valley 2014 - API Antipatterns
PDF
Scalabay - API Design Antipatterns
PDF
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
PPTX
API Design Antipatterns - APICon SF
PPTX
Motivation : it Matters
PPTX
Building Apis in Scala with Playframework2
PPTX
Scala at Netflix
PPT
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
PPT
Evolving IGN’s New APIs with Scala
PPTX
IGN's V3 API
PPTX
Java and the JVM
PPTX
Object Oriented Programming
PPTX
Silicon Valley Code Camp 2011: Play! as you REST
PPTX
Silicon Valley Code Camp: 2011 Introduction to MongoDB
Disaster recovery - What, Why, and How
Serverless Architectures on AWS in practice - OSCON 2018
Disaster Recovery and Reliability
Immutable AWS Deployments with Packer and Jenkins
AWS Lambda with Serverless Framework and Java
AWS Primer and Quickstart
Silicon Valley 2014 - API Antipatterns
Scalabay - API Design Antipatterns
OSCON 2014 - API Ecosystem with Scala, Scalatra, and Swagger at Netflix
API Design Antipatterns - APICon SF
Motivation : it Matters
Building Apis in Scala with Playframework2
Scala at Netflix
Introducing Scala to your Ruby/Java Shop : My experiences at IGN
Evolving IGN’s New APIs with Scala
IGN's V3 API
Java and the JVM
Object Oriented Programming
Silicon Valley Code Camp 2011: Play! as you REST
Silicon Valley Code Camp: 2011 Introduction to MongoDB

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Empathic Computing: Creating Shared Understanding
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPT
Teaching material agriculture food technology
PPTX
A Presentation on Artificial Intelligence
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Electronic commerce courselecture one. Pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
Review of recent advances in non-invasive hemoglobin estimation
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MYSQL Presentation for SQL database connectivity
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
Empathic Computing: Creating Shared Understanding
Reach Out and Touch Someone: Haptics and Empathic Computing
Dropbox Q2 2025 Financial Results & Investor Presentation
Chapter 3 Spatial Domain Image Processing.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Advanced methodologies resolving dimensionality complications for autism neur...
Teaching material agriculture food technology
A Presentation on Artificial Intelligence
Per capita expenditure prediction using model stacking based on satellite ima...
Electronic commerce courselecture one. Pdf
NewMind AI Monthly Chronicles - July 2025
Mobile App Security Testing_ A Comprehensive Guide.pdf
20250228 LYD VKU AI Blended-Learning.pptx

OAuth2 primer

  • 5. OAuth Primer The Need OAuth as a Standard OAuth in Practice
  • 6. Identity and Authorization I want TurboTax to pull my trades from Fidelity
  • 7. But... I do not want to give my Fidelity password to TurboTax I do not want TurboTax to pull anything other than trades I want the ability to revoke TurboTax’s access to my Fidelity Account
  • 8. So.. Access Keys Whitelisting HTTP Basic Screen Scraping with stored credentials Wide open access/No authorization
  • 9. And there is more.. Mobile IoT Devices Service to Service Client-Server Applications Rich Client Applications
  • 10. Need for.. A secure standard for access authorization without the password leaving the site where the protected data is. Short-lived tokens in lieu of passwords to access information. A standard that works across all the API access patterns.
  • 12. OAuth 2.0 OAuth is an open standard for access delegation, commonly used as a way for Internet users to grant websites or applications access to their information on other websites but without giving them the passwords. (Wikipedia) OAuth 2.0 relies on HTTP over TLS OAuth is an authorization protocol, and NOT an authentication protocol. * I still have bad dreams about OAuth 1.0 and 1.0a
  • 15. Terminology The OAuth spec outlines the basic terms that build upon the standard. ● Resource Owner ● Resource Server ● Client ● Authorization Server
  • 16. Connecting the dots Resource Owner is the user whose resources (data) exists on a Resource Server. The Resource Owner grants access to a Client to access these resources, by authorizing access to those resources on an Authorization Server where his identity exists and can be authenticated. The Client then gets credentials from the Authorization Server that can be used on the Resource Owner’s behalf to access the resources on the Resource Server.
  • 17. Authorization Examples A Twitter desktop client posting tweets on your behalf MyFitnessPal getting your Step Count from your Fitbit Account Turbotax getting your trades from your Fidelity Account Instacart Servers calling Marqeta’s API Facebook iOS app accessing your Facebook account Single Page App (RCA) accessing your News Aggregator
  • 18. OAuth 2.0 Constructs Client ID Client Secret Scope Grant Type Access Token Refresh Token
  • 19. Client ID and Client Secret Identify the client which could be an web application, a single page app, a native mobile app, or a server
  • 20. Grant Type Steps that define the authorization protocol, resulting in an access token.
  • 21. Access Tokens Short lived (hours, days, weeks, months?), bearer tokens that the client can use to act on behalf of the resource owner.
  • 22. Refresh Tokens Long lived tokens, used to request a new access token upon expiry of the current one, without Resource Owner intervention.
  • 23. Scope Scopes define the which resources can be accessed by the client using the access token. Scopes can be sliced and diced in many ways - Read vs. Write, Functionality based, Default, etc. Be careful defining them - you’ll end up with an LDAP ACLs. Scopes <> ACL.
  • 24. Authorization Code Grant For client/server web applications, also known as delegated authentication. Also known as 3-legged OAuth. Quiz - Guess the 3 legs
  • 25. Authorization Code Grant Flow 1. The client redirects the resource owner to the authorization server by passing in the response_type=code, redirect_uri, scope, and client_id. 2. The authorization server asks the resource owner for his credentials, MFA may be performed here. 3. The authorization server asks the resource owner to pick scopes that the client will be authorized for. 4. Upon the resource owner granting access, the authorization server sends a short lived authorization code to the redirect_uri 5. The client uses this authorization code to do a POST on the authorization server, passing in client_id, client_secret, and grant_type=authorization_code. 6. The client receives a refresh token and and access token.
  • 27. Implicit Grant For Single Page Apps, or Desktop Clients, or Browser Extensions.. There is no client_secret since the client cannot keep the secret. A simplified version of Authorization Code Grant. A refresh token is not returned in the response. Never, ever used in Financial Systems.
  • 28. Implicit Grant Flow 1. Client redirects the resource owner to the authorization URL same as Authorization Code Flow, except response_type is token (vs. code), and grant_type is not passed. 2. Upon the access being granted by the resource owner, an Access Token is provided to the client.
  • 29. Resource Owner Password Grant For fully trusted clients, like Native Mobile Apps provided by the Resource Server who is also the Identity Server. The only grant type where a user’s credentials are passed in the token request. Also known as Password Grant
  • 30. Resource Owner Password Grant Flow 1. Client sends request to the Authorization server as a POST with grant_type=password, client_id, client_secret, scope, username, and password. 2. The Authorization Server responds with an access token and a refresh token.
  • 31. Client Credentials Grant For server to service, or machine to machine, or service to service call. There is no identity involved. Also known as 2-legged OAuth. A refresh token is not returned. Simplest of all grant types. Additional security via whitelisting and firewalling can be implemented.
  • 32. Client Credentials Grant Flow 1. Client sends a POST request to the authorization server with client_id, client_secret, grant_type=client_credentials and scope. 2. Authorization server returns an access token to the client.
  • 33. Demo – CapitalOne Credit Offers
  • 35. References The OAuth2 Spec, RFC 6749 https://tools.ietf.org/html/rfc6749 The OAuth Bible http://oauthbible.com/ A Guide to OAuth2 Grant Types https://alexbilbie.com/guide-to-oauth-2-grants/