SlideShare a Scribd company logo
OAuth 2.0 -
Don’t Throw the Baby Out with
the Bathwater

Greg Brail
@gbrail

Ed Anuff                         Apigee
@edanuff                        @apigee
groups.google.com/group/api-craft
youtube.com/apigee
slideshare.net/apigee
@edanuff    @gbrail
Ed Anuff   Greg Brail
Overview



What happened?

OAuth 2.0 refresher course

OAuth in the world

Next steps and recommendations
WHAT HAPPENED?
What happened?




Eran Hammer-Lahav, one of the spec leads, quit

He blogged about how screwed up OAuth 2.0 is

He got a lot of attention

Some other people blogged about his blog
Why does it matter?




One of the primary authors of OAuth 2.0 disowned it.
So is this an excuse to give up on OAuth?



We don’t think so
OAUTH 1.0 & 2.0 RECAP
OAuth 1.0a recap




Start with:
       Application credentials (ID and secret)
       Authenticate the user
       Web browser redirect
       Get a token and secret
       Sign with it on every request
What was wrong with OAuth 1.0?




Signatures are hard


       This may seem minor but ask the “developer on the
street” about OAuth and you will get some version of this
response
What is OAuth 2.0?




A family of specs
      The “authorization framework”

      Bearer token spec

      SAML, JWT, and other token specs

      More specs
What does it really do?

Start with “client credentials”
  These identify the application requesting authentication

Optionally authenticate the user
  There are many “grant types” that define this

Get an “access token”
      Uniquely identifies the user / application / device

Send the access token on every request
OAuth 2.0 grant types

Grant Type            What You Need                     How You Authenticate User
Authorization Code    App Credentials                   Web browser redirect. Web
                      End-user credentials              app determines what is
                                                        required
Implicit Grant        App Credentials                   Web browser redirect
                      End-user credentials              optimized for script-heavy
                                                        web apps
Resource Owner        App Credentials                   Send username / password in
                      End-user username / password      API call
Client Credentials    App Credentials                   You don’t
Extensions            SAML token, JSON web token        Depends on the extension
                                                        spec
In OAuth 2.0, “app credentials” are essentially
a username / password that identifies a single application
OAuth 2.0 token types

Token Type   What it Is       Signed? Spec Status
Bearer       A big random     N       Proposed Standard
             number
HTTP-MAC     Signed request   Y       Very old

   For reference: OAuth 1.0 only supported a “Mac” style of token
Security considerations

Token Type   On the Wire                         On the Disk
Bearer       Totally open – requires SSL to      Hash it just like a password
             prevent token theft or misuse
“Mac”        Secure – secret cannot be reverse   Server must access it in clear
             engineered and “nonce” prevents     text
             replay. No SSL required.
What about “legs?”

Three grant types require user authentication
      Many people call these “three-legged”
      They involve the app, the API, and the user

One does not – it just uses the app credentials
     Many people call this “two-legged”



Minor fact – the words “leg” and “legged” are not present in the spec
Scopes



Every OAuth 2.0 token can have “scopes”

Identify what the token can do
For instance:
       READ, WRITE, DELETE
or
       SEND_SMS, SEND_MMS, GET_LOCATION, PAY
Refresh tokens




APIs may return two tokens
      Access token with an expiration time
      Refresh token with no expiration time

Refresh token used to get a new access token
      No additional user authentication is required
Why refresh tokens?




What if the access token is compromised?
      Harder to guess if it has an expiration time
      Harder to use a stolen token from a device

So why is the refresh token harder to steal?
     It isn’t
     It’s still stored on the device or web server
Why refresh tokens, really?



It supports a two-tier architecture:
      Authorization grants, token generation,
            and all that on a complex, slow server
      Access tokens in a scalable caching layer
      No need for complex cache invalidation


What if the main OAuth system already scales?
      Then there is no reason to use refresh tokens
OAUTH IN THE WORLD
Status of key specs

Spec                         Revision    Status
Authorization Framework      31          Proposed Standard
Bearer Token                 23          Proposed Standard
JWT Token                    3           Draft
JWT Bearer Token             1           Draft
SAML 2 Token                 13          Draft
HTTP MAC Token               1           Draft; Last update February

How a spec grows up to become a “law:”
1. Draft
2. Proposed Standard
3. Draft Standard
4. Internet Standard
                            There are many more specs – check the IETF process:
                                                  http://tools.ietf.org/wg/oauth/
Status of big APIs
Provider             Spec Revision       Reference
Foursquare           10                  http://aaron.pk/2YS
Google               10                  https://developers.google.com/acco
                                         unts/docs/
                                         OAuth2
Facebook             10*                 https://developers.facebook.com/d
                                         ocs/
                                         authentication/
Windows Live         10                  http://aaron.pk/2YV
Salesforce           10                  http://aaron.pk/2YW
GitHub               7                   http://developer.github.com/v3/oa
                                         uth/
Geoloqi              10                  https://developers.geoloqi.com/api

                               Thanks to Aaron Parecki from Geoloqi for this table
OAuth in production - versions

31 Apigee Enterprise customers use OAuth 2.0
      20 have “two-legged OAuth” aka “client credentials”
      19 have “three-legged OAuth”
      8 have both
6 Customers have OAuth 1.0a

Many customers have neither
      “API Key” authentication only
      Username / password
      SSL, many other options
                                      Thanks to Amit Chakraborty from Apigee for this data
Two more steps to OAuth


It’s not just about tokens

How is the user authenticated?
      All but two Apigee customers use existing web pages
      or directory servers for user authentication

How is consent granted to issue the token?
      Usually done through the browser
      Many different ways to implement it
NEXT STEPS AND
RECOMMENDATIONS
Why use OAuth?

For web apps that use APIs
      OAuth is the most standard, secure choice

For mobile / native apps that use APIs
      OAuth has advantages over alternatives
            Uniquely identifies the end user, device, and app
            Credentials may be revoked at any time

For server-to-server APIs
      Use OAuth if you use it for other things too
Keeping OAuth under control




Stick with the basics:
      Bearer tokens

      No refresh tokens

      No extensions
Questions
groups.google.com/group/api-craft
THANK YOU
Questions and ideas to:
@gbrail
@ edanuff

groups.google.com/group/api-craft

More Related Content

PDF
OAuth 2.0
PDF
Implementing OAuth
PDF
OAuth 2.0 and OpenID Connect
PPTX
An introduction to OAuth 2
PPTX
An Introduction to OAuth 2
PPTX
OAuth 2
PPTX
An Introduction to OAuth2
PPTX
OAuth 2.0
Implementing OAuth
OAuth 2.0 and OpenID Connect
An introduction to OAuth 2
An Introduction to OAuth 2
OAuth 2
An Introduction to OAuth2

What's hot (20)

PPTX
OpenID Connect: An Overview
PDF
OAuth & OpenID Connect Deep Dive
PPT
OAuth 2.0 and OpenId Connect
PDF
OpenID Connect Explained
PDF
Demystifying OAuth 2.0
PDF
SAML VS OAuth 2.0 VS OpenID Connect
PPTX
Rest API Security
PDF
Introduction to OpenID Connect
PDF
API Security Best Practices & Guidelines
PDF
Single Sign On - The Basics
PPTX
Rest API Security - A quick understanding of Rest API Security
PDF
Api Gateway
ODP
OAuth2 - Introduction
PPTX
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
PPTX
Intro to OAuth2 and OpenID Connect
PDF
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
PDF
Jwt Security
PPTX
Springboot Microservices
PDF
API Security Best Practices & Guidelines
OpenID Connect: An Overview
OAuth & OpenID Connect Deep Dive
OAuth 2.0 and OpenId Connect
OpenID Connect Explained
Demystifying OAuth 2.0
SAML VS OAuth 2.0 VS OpenID Connect
Rest API Security
Introduction to OpenID Connect
API Security Best Practices & Guidelines
Single Sign On - The Basics
Rest API Security - A quick understanding of Rest API Security
Api Gateway
OAuth2 - Introduction
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
Intro to OAuth2 and OpenID Connect
API Gateway How-To: The Many Ways to Apply the Gateway Pattern
Jwt Security
Springboot Microservices
API Security Best Practices & Guidelines
Ad

Viewers also liked (12)

PDF
Modernize Service-Oriented Architecture with APIs
PPTX
API and SOA: Two Sides of the Same Coin?
PDF
Differentiating between web APIs, SOA, & integration …and why it matters
PDF
Is Microservices SOA Done Right?
PDF
Are ESBs Relevant in the Age of Microservices?
PPTX
Becoming the Uncarrier: T-Mobile's Digital Journey
PPTX
What's Better than Microservices? Serverless Microservices.
PPTX
API Governance in the Enterprise
PPTX
API Management and Kubernetes
PDF
Adapt or Die: Keynote with Greg Brail
PPTX
Managing Sensitive Information in an API and Microservices World
PPTX
Microservices Done Right: Key Ingredients for Microservices Success
Modernize Service-Oriented Architecture with APIs
API and SOA: Two Sides of the Same Coin?
Differentiating between web APIs, SOA, & integration …and why it matters
Is Microservices SOA Done Right?
Are ESBs Relevant in the Age of Microservices?
Becoming the Uncarrier: T-Mobile's Digital Journey
What's Better than Microservices? Serverless Microservices.
API Governance in the Enterprise
API Management and Kubernetes
Adapt or Die: Keynote with Greg Brail
Managing Sensitive Information in an API and Microservices World
Microservices Done Right: Key Ingredients for Microservices Success
Ad

Similar to OAuth - Don’t Throw the Baby Out with the Bathwater (20)

PPTX
OAuth
PPTX
Api security
PPTX
Devteach 2017 OAuth and Open id connect demystified
PPT
Securing RESTful API
PDF
JDD2015: Security in the era of modern applications and services - Bolesław D...
PDF
Distributed Identities with OpenID
PPTX
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
PDF
When and Why Would I use Oauth2?
PDF
OAuth2
PDF
OAuth: Trust Issues
PPTX
Single-Page-Application & REST security
PDF
Distributed Identities with OpenID
PPT
Oauth2.0
PDF
OAuth for your API - The Big Picture
PDF
Applications and deployment patterns of o auth and open id connect
PDF
RFC6749 et alia 20130504
PDF
A How-to Guide to OAuth & API Security
PPTX
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control
PDF
Full stack security
OAuth
Api security
Devteach 2017 OAuth and Open id connect demystified
Securing RESTful API
JDD2015: Security in the era of modern applications and services - Bolesław D...
Distributed Identities with OpenID
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
When and Why Would I use Oauth2?
OAuth2
OAuth: Trust Issues
Single-Page-Application & REST security
Distributed Identities with OpenID
Oauth2.0
OAuth for your API - The Big Picture
Applications and deployment patterns of o auth and open id connect
RFC6749 et alia 20130504
A How-to Guide to OAuth & API Security
OAuth-as-a-service using ASP.NET Web API and Windows Azure Access Control
Full stack security

More from Apigee | Google Cloud (20)

PDF
How Secure Are Your APIs?
PDF
Magazine Luiza at a glance (1)
PPTX
Monetization: Unlock More Value from Your APIs
PDF
Apigee Demo: API Platform Overview
PDF
Ticketmaster at a glance
PDF
AccuWeather: Recasting API Experiences in a Developer-First World
PDF
Which Application Modernization Pattern Is Right For You?
PPTX
Apigee Product Roadmap Part 2
PPTX
The Four Transformative Forces of the API Management Market
PDF
Walgreens at a glance
PDF
Apigee Edge: Intro to Microgateway
PDF
Managing the Complexity of Microservices Deployments
PDF
Pitney Bowes at a glance
PDF
Adapt or Die: Opening Keynote with Chet Kapoor
PDF
Adapt or Die: Keynote with Anant Jhingran
PDF
London Adapt or Die: Opening Keynot
PDF
London Adapt or Die: Lunch keynote
PDF
London Adapt or Die: Closing Keynote — Adapt Now!
PPTX
London adapt or-die opening keynote chet kapoor
PPTX
London Adapt or Die: Opening Keynote with Chet Kapoor
How Secure Are Your APIs?
Magazine Luiza at a glance (1)
Monetization: Unlock More Value from Your APIs
Apigee Demo: API Platform Overview
Ticketmaster at a glance
AccuWeather: Recasting API Experiences in a Developer-First World
Which Application Modernization Pattern Is Right For You?
Apigee Product Roadmap Part 2
The Four Transformative Forces of the API Management Market
Walgreens at a glance
Apigee Edge: Intro to Microgateway
Managing the Complexity of Microservices Deployments
Pitney Bowes at a glance
Adapt or Die: Opening Keynote with Chet Kapoor
Adapt or Die: Keynote with Anant Jhingran
London Adapt or Die: Opening Keynot
London Adapt or Die: Lunch keynote
London Adapt or Die: Closing Keynote — Adapt Now!
London adapt or-die opening keynote chet kapoor
London Adapt or Die: Opening Keynote with Chet Kapoor

Recently uploaded (20)

PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Zenith AI: Advanced Artificial Intelligence
PPTX
SOPHOS-XG Firewall Administrator PPT.pptx
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Mushroom cultivation and it's methods.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
1 - Historical Antecedents, Social Consideration.pdf
PDF
Hybrid model detection and classification of lung cancer
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Approach and Philosophy of On baking technology
PDF
A comparative study of natural language inference in Swahili using monolingua...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Web App vs Mobile App What Should You Build First.pdf
PPTX
cloud_computing_Infrastucture_as_cloud_p
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Zenith AI: Advanced Artificial Intelligence
SOPHOS-XG Firewall Administrator PPT.pptx
Heart disease approach using modified random forest and particle swarm optimi...
NewMind AI Weekly Chronicles - August'25-Week II
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Chapter 5: Probability Theory and Statistics
Mushroom cultivation and it's methods.pdf
Encapsulation_ Review paper, used for researhc scholars
Group 1 Presentation -Planning and Decision Making .pptx
1 - Historical Antecedents, Social Consideration.pdf
Hybrid model detection and classification of lung cancer
Assigned Numbers - 2025 - Bluetooth® Document
Approach and Philosophy of On baking technology
A comparative study of natural language inference in Swahili using monolingua...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Unlocking AI with Model Context Protocol (MCP)
Web App vs Mobile App What Should You Build First.pdf
cloud_computing_Infrastucture_as_cloud_p

OAuth - Don’t Throw the Baby Out with the Bathwater

  • 1. OAuth 2.0 - Don’t Throw the Baby Out with the Bathwater Greg Brail @gbrail Ed Anuff Apigee @edanuff @apigee
  • 5. @edanuff @gbrail Ed Anuff Greg Brail
  • 6. Overview What happened? OAuth 2.0 refresher course OAuth in the world Next steps and recommendations
  • 8. What happened? Eran Hammer-Lahav, one of the spec leads, quit He blogged about how screwed up OAuth 2.0 is He got a lot of attention Some other people blogged about his blog
  • 9. Why does it matter? One of the primary authors of OAuth 2.0 disowned it. So is this an excuse to give up on OAuth? We don’t think so
  • 10. OAUTH 1.0 & 2.0 RECAP
  • 11. OAuth 1.0a recap Start with: Application credentials (ID and secret) Authenticate the user Web browser redirect Get a token and secret Sign with it on every request
  • 12. What was wrong with OAuth 1.0? Signatures are hard This may seem minor but ask the “developer on the street” about OAuth and you will get some version of this response
  • 13. What is OAuth 2.0? A family of specs The “authorization framework” Bearer token spec SAML, JWT, and other token specs More specs
  • 14. What does it really do? Start with “client credentials” These identify the application requesting authentication Optionally authenticate the user There are many “grant types” that define this Get an “access token” Uniquely identifies the user / application / device Send the access token on every request
  • 15. OAuth 2.0 grant types Grant Type What You Need How You Authenticate User Authorization Code App Credentials Web browser redirect. Web End-user credentials app determines what is required Implicit Grant App Credentials Web browser redirect End-user credentials optimized for script-heavy web apps Resource Owner App Credentials Send username / password in End-user username / password API call Client Credentials App Credentials You don’t Extensions SAML token, JSON web token Depends on the extension spec In OAuth 2.0, “app credentials” are essentially a username / password that identifies a single application
  • 16. OAuth 2.0 token types Token Type What it Is Signed? Spec Status Bearer A big random N Proposed Standard number HTTP-MAC Signed request Y Very old For reference: OAuth 1.0 only supported a “Mac” style of token
  • 17. Security considerations Token Type On the Wire On the Disk Bearer Totally open – requires SSL to Hash it just like a password prevent token theft or misuse “Mac” Secure – secret cannot be reverse Server must access it in clear engineered and “nonce” prevents text replay. No SSL required.
  • 18. What about “legs?” Three grant types require user authentication Many people call these “three-legged” They involve the app, the API, and the user One does not – it just uses the app credentials Many people call this “two-legged” Minor fact – the words “leg” and “legged” are not present in the spec
  • 19. Scopes Every OAuth 2.0 token can have “scopes” Identify what the token can do For instance: READ, WRITE, DELETE or SEND_SMS, SEND_MMS, GET_LOCATION, PAY
  • 20. Refresh tokens APIs may return two tokens Access token with an expiration time Refresh token with no expiration time Refresh token used to get a new access token No additional user authentication is required
  • 21. Why refresh tokens? What if the access token is compromised? Harder to guess if it has an expiration time Harder to use a stolen token from a device So why is the refresh token harder to steal? It isn’t It’s still stored on the device or web server
  • 22. Why refresh tokens, really? It supports a two-tier architecture: Authorization grants, token generation, and all that on a complex, slow server Access tokens in a scalable caching layer No need for complex cache invalidation What if the main OAuth system already scales? Then there is no reason to use refresh tokens
  • 23. OAUTH IN THE WORLD
  • 24. Status of key specs Spec Revision Status Authorization Framework 31 Proposed Standard Bearer Token 23 Proposed Standard JWT Token 3 Draft JWT Bearer Token 1 Draft SAML 2 Token 13 Draft HTTP MAC Token 1 Draft; Last update February How a spec grows up to become a “law:” 1. Draft 2. Proposed Standard 3. Draft Standard 4. Internet Standard There are many more specs – check the IETF process: http://tools.ietf.org/wg/oauth/
  • 25. Status of big APIs Provider Spec Revision Reference Foursquare 10 http://aaron.pk/2YS Google 10 https://developers.google.com/acco unts/docs/ OAuth2 Facebook 10* https://developers.facebook.com/d ocs/ authentication/ Windows Live 10 http://aaron.pk/2YV Salesforce 10 http://aaron.pk/2YW GitHub 7 http://developer.github.com/v3/oa uth/ Geoloqi 10 https://developers.geoloqi.com/api Thanks to Aaron Parecki from Geoloqi for this table
  • 26. OAuth in production - versions 31 Apigee Enterprise customers use OAuth 2.0 20 have “two-legged OAuth” aka “client credentials” 19 have “three-legged OAuth” 8 have both 6 Customers have OAuth 1.0a Many customers have neither “API Key” authentication only Username / password SSL, many other options Thanks to Amit Chakraborty from Apigee for this data
  • 27. Two more steps to OAuth It’s not just about tokens How is the user authenticated? All but two Apigee customers use existing web pages or directory servers for user authentication How is consent granted to issue the token? Usually done through the browser Many different ways to implement it
  • 29. Why use OAuth? For web apps that use APIs OAuth is the most standard, secure choice For mobile / native apps that use APIs OAuth has advantages over alternatives Uniquely identifies the end user, device, and app Credentials may be revoked at any time For server-to-server APIs Use OAuth if you use it for other things too
  • 30. Keeping OAuth under control Stick with the basics: Bearer tokens No refresh tokens No extensions
  • 33. THANK YOU Questions and ideas to: @gbrail @ edanuff groups.google.com/group/api-craft

Editor's Notes

  • #2: Creative Commons Attribution-Share Alike 3.0 United States License