SlideShare a Scribd company logo
Authorization with OAuth
          Rob Richards
        October 22, 2009
          cdatazone.org
   http://xri.net/=rob.richards
Authentication

• HTTP Authentication
  • Basic
  • Digest
  • TLS/SSL
• WS-Security
• Developer Keys
• 3rd Party Authentication
  • Yahoo BBAuth
  • AOL OpenAuth
OAuth




   An Open Protocol
       to allow
Secure API Authorization
Oauth is not OpenID




       Oauth
      Is Like
      OpenID
Data Authorization




Plaxo
OAuth




 OAuth
is like a
Valet Key
OAuth




   OAuth
   is like a
Hotel Keycard
M as ter K ey




101       103    105   107




102       104    106   108
Gues t K ey: Granting Acces s




       101      103      105    107




        102     104      106    108
Gues t K ey: R evoking Acces s




       101       103      105    107




        102      104      106    108
M as ter K ey M aintains Full Acces s




           101       103      105       107




           102       104      106       108
Oauth C lients
OAuth and Netf ix
              l

developer.netf ix.com
             l
Netf ix API
   l
Netf ix API: Us er R es ources
   l
Netf ix Applications ... and many more
   l
Obtaining a C ons umer K ey / S ecret
Obtaining a C ons umer K ey / S ecret
3-Leg g ed OAuth
“The OAuth Dance”
S tep 1: Obtaining a R eques t Token


http://api.netfix.com/oauth/request_token


            Signed Request




           Request Token & Secret
S tep 1: Obtaining a R eques t Token


http://api.netfix.com/oauth/request_token?
oauth_callback=http%3A%2F%2Fwww.example.com%2Fcallback
&oauth_consumer_key=1234567890123456789012345
&oauth_nonce=60a3f1c4a18c2a68d8cb216f46bceb4ad7dff32e
&oauth_signature=SB%2BjBrcHkQRgMP8XKVyps3rw6Xo%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1255631744
&oauth_version=1.0
C alculating The S ig nature


Calculate Base String
<HTTP method>&<canonicalized URL path>&<parameters>


GET&http%3A%2F%2Fapi.netfix.com%2Foauth
 %2Frequest_token&oauth_callback%3Dhttp%253A%252F
 %252Fwww.example.com%252Fcallback
 %26oauth_consumer_key
 %3D1234567890123456789012345%26oauth_nonce
 %3D3eb496472d2a46ceb71d65fc1b7341ae359f932c
 %26oauth_signature_method%3DHMAC-
 SHA1%26oauth_timestamp
 %3D1255631744%26oauth_version%3D1.0
C alculating The S ig nature


• Parameters are collected, sorted and concatenated into a
   normalized string
  • Parameters in the OAuth HTTP Authorization header excluding the realm
     parameter.
  • Parameters in the HTTP POST request body (with a content-type of
     application/x-www-form-urlencoded).
  • HTTP GET parameters added to the URLs in the query part (as defned by
     [RFC3986] section 3)
• The oauth_signature parameter MUST be excluded
• Parameters are sorted by name, using lexicographical byte
   value ordering
C alculating The S ig nature (Authorization Header)


GET /oauth/request_token HTTP/1.1
User-Agent: PECL::HTTP/1.6.4 (PHP/5.2.10)
Host: api.netfix.com
Accept: */*
Authorization: OAuth oauth_callback="http%3A%2F
 %2Fwww.example.com%2Fcallback",
 oauth_consumer_key="1234567890123456789012345",
 oauth_nonce="60a3f1c4a18c2a68d8cb216f46bceb4ad7dff32e",
 oauth_signature="SB%2BjBrcHkQRgMP8XKVyps3rw6Xo%3D",
 oauth_signature_method="HMAC-SHA1",
 oauth_timestamp="1255631744", oauth_version="1.0"
C alculating The S ig nature


Create Secret
<consumer secret>&<token secret>
1234567890123456789012345&


Sign Base String using algorithm specifed
HMAC(1234567890123456789012345&,<Base String>)


Base64 encode then URL encode result:
oauth_signature=SB%2BjBrcHkQRgMP8XKVyps3rw6Xo%3D
S tep 1: Obtaining a R eques t Token (R es pons e)


oauth_token=bqba9rku48yacfatjxjw3fkc
&oauth_token_secret=EZ2mBk6rC2vZ
&oauth_callback_confrmed=true
&login_url=https%3A%2F%2Fapi-user.netfix.com%2Foauth
 %2Flogin
S tep 2: Us er Authentication

              Determined by needs of Service Provider
https://api-user.netfix.com/oauth/login?oauth_token=bqba9rku48yacfatjxjw3fkc
S tep 2: Us er Authentication

Determined by needs of Service Provider



                  Callback




oauth_token=bqba9rku48yacfatjxjw3fkc&oauth_verifer=abcdefg
S tep 2: Us er Authentication

Determined by needs of Service Provider
Oauth Trus t




A Matter
   Of
  Trust
S tep 3: Obtaining an Acces s Token


http://api.netfix.com/oauth/access_token


            Signed Request




           Access Token & Secret
S tep 3: Obtaining an Acces s Token


http://api.netfix.com/oauth/access_token?
oauth_consumer_key=1234567890123456789012345
&oauth_nonce=0a5ebd08b88e3ec7d7e27c7fb8735c7aa9a7229a
&oauth_signature=FXDtkQtg6u42YYipJhBgCBvVXHI%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1255704433
&oauth_token=bqba9rku48yacfatjxjw3fkc
&oauth_verifer=abcdefg
&oauth_version=1.0
C alculating The S ig nature


Calculate Base String
<HTTP method>&<canonicalized URL path>&<parameters>


GET&http%3A%2F%2Fapi.netfix.com%2Foauth
 %2Faccess_token&oauth_consumer_key
 %3D1234567890123456789012345%26oauth_nonce
 %3D0a5ebd08b88e3ec7d7e27c7fb8735c7aa9a7229a
 %26oauth_signature_method%3DHMAC-
 SHA1%26oauth_timestamp%3D1255704433%26oauth_token
 %3Dbqba9rku48yacfatjxjw3fkc%26oauth_verifer%3Dabcdefg
 %26oauth_version%3D1.0
C alculating The S ig nature


Create Secret
<consumer secret>&<token secret>
1234567890123456789012345&EZ2mBk6rC2vZ


Sign Base String using algorithm specifed
HMAC(1234567890123456789012345&EZ2mBk6rC2vZ,<Base String>)


Base64 encode then URL encode result:
oauth_signature=eCLuRjEhSB%2BFImlN8sqrusPd9AE%3D
S tep 3: Obtaining an Acces s Token (R es pons e)


oauth_token=5432109876543210987654321
&user_id=123myuserid456
&oauth_token_secret=543210987654321
Acces s ing R es ources


http://api.netfix.com/<path to resource>

            Signed Request




               Resource
Acces s ing R es ources


http://api.netfix.com/users/123myuserid456/queues?
oauth_consumer_key=1234567890123456789012345
&oauth_nonce=0c36fbefee5af0316687c6984a32c0184526e7b2
&oauth_signature=IXkzzAhF9hnsFIeftxEdfG0nx1s%3D
&oauth_signature_method=HMAC-SHA1
&oauth_timestamp=1255712310
&oauth_token=5432109876543210987654321
&oauth_version=1.0
&v=1.5
C alculating The S ig nature


Create Secret
<consumer secret>&<token secret>
1234567890123456789012345&543210987654321


Sign Base String using algorithm specifed
HMAC(1234567890123456789012345&543210987654321,<Base String>)



Base64 encode then URL encode result:
oauth_signature=IXkzzAhF9hnsFIeftxEdfG0nx1s%3D
Acces s ing R es ources (R es pons e)

<?xml version="1.0" standalone="yes"?>
<resource>
 <link href="http://api.netfix.com/users/123myuserid456/queues/disc"
      rel="http://schemas.netfix.com/queues.disc" title="disc queue" />
 <link href="http://api.netfix.com/users/123myuserid456/queues/instant"
      rel="http://schemas.netfix.com/queues.instant"
      title="instant queue" />
</resource>
Acces s ing R es ources (R es pons e)
M anag ing Acces s Tokens
2-Leg g ed OAuth


• No Dance Required
• Only Consumer Key and Secret required
• Application making requests on its own behalf
• Direct Access / No Delegation
• Replacement for HTTP Basic Authentication
• Sign request just as if they were requests for Request
   Tokens
Ques tions ?




Authorization with OAuth

        Rob Richards

  http://xri.net/=rob.richards
     www.cdatazone.org

More Related Content

PPTX
PDF
Introduction to OAuth
PPTX
OAuth 2 at Webvisions
PDF
Building a Microgateway in Ballerina_KubeCon 2108
PPTX
Token Based Authentication Systems with AngularJS & NodeJS
PDF
OAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
PDF
2016 pycontw web api authentication
PDF
What the Heck is OAuth and Open ID Connect? - UberConf 2017
Introduction to OAuth
OAuth 2 at Webvisions
Building a Microgateway in Ballerina_KubeCon 2108
Token Based Authentication Systems with AngularJS & NodeJS
OAuth Hacks A gentle introduction to OAuth 2 and Apache Oltu
2016 pycontw web api authentication
What the Heck is OAuth and Open ID Connect? - UberConf 2017

What's hot (18)

PDF
The Current State of OAuth 2
PPTX
Esquema de pasos de ejecución IdM
PDF
OAuth 2.0 and Library
PDF
OAuth 2.0
PDF
WordCamp Antwerp - 3/3/2018 - Debugging WordPress by Brecht Ryckaert
PPTX
An Introduction to OAuth2
PDF
Stateless authentication for microservices - Greach 2015
PDF
Some OAuth love
PPTX
Adding Identity Management and Access Control to your Application, Authorization
PDF
OAuth 2.0 – A standard is coming of age by Uwe Friedrichsen
PDF
Demystifying OAuth 2.0
PPTX
HTTPS and YOU
PDF
Implementing OAuth
PPTX
REST Service Authetication with TLS & JWTs
PDF
What the Heck is OAuth and OIDC - UberConf 2018
PDF
iMasters Intercon 2016 - Identity within Microservices
PDF
Using OAuth with PHP
PDF
Stateless authentication for microservices - Spring I/O 2015
The Current State of OAuth 2
Esquema de pasos de ejecución IdM
OAuth 2.0 and Library
OAuth 2.0
WordCamp Antwerp - 3/3/2018 - Debugging WordPress by Brecht Ryckaert
An Introduction to OAuth2
Stateless authentication for microservices - Greach 2015
Some OAuth love
Adding Identity Management and Access Control to your Application, Authorization
OAuth 2.0 – A standard is coming of age by Uwe Friedrichsen
Demystifying OAuth 2.0
HTTPS and YOU
Implementing OAuth
REST Service Authetication with TLS & JWTs
What the Heck is OAuth and OIDC - UberConf 2018
iMasters Intercon 2016 - Identity within Microservices
Using OAuth with PHP
Stateless authentication for microservices - Spring I/O 2015
Ad

Similar to O auth how_to (20)

PPTX
MainFinalOAuth
PDF
Secure Webservices
PDF
OAuth and OEmbed
PPTX
Best Practices in Building an API Security Ecosystem
PPTX
Maintest 100713212237-phpapp02-100714080303-phpapp02
PPTX
Maintest 100713212237-phpapp02-100714080303-phpapp02
PDF
Oauth Php App
PDF
Implementing OAuth with PHP
PPTX
Oauth 2.0 security
PPTX
OAuth [noddyCha]
PPT
Silicon Valley Code Camp 2009: OAuth: What, Why and How
PPTX
OAuth
PDF
Draft Ietf Oauth V2 12
PDF
MainFinalOAuth
Secure Webservices
OAuth and OEmbed
Best Practices in Building an API Security Ecosystem
Maintest 100713212237-phpapp02-100714080303-phpapp02
Maintest 100713212237-phpapp02-100714080303-phpapp02
Oauth Php App
Implementing OAuth with PHP
Oauth 2.0 security
OAuth [noddyCha]
Silicon Valley Code Camp 2009: OAuth: What, Why and How
OAuth
Draft Ietf Oauth V2 12
Ad

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Unlocking AI with Model Context Protocol (MCP)
PPT
Teaching material agriculture food technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Encapsulation theory and applications.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Electronic commerce courselecture one. Pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Big Data Technologies - Introduction.pptx
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Unlocking AI with Model Context Protocol (MCP)
Teaching material agriculture food technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation_ Review paper, used for researhc scholars
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
MIND Revenue Release Quarter 2 2025 Press Release
Per capita expenditure prediction using model stacking based on satellite ima...
sap open course for s4hana steps from ECC to s4
Encapsulation theory and applications.pdf
Network Security Unit 5.pdf for BCA BBA.
NewMind AI Weekly Chronicles - August'25 Week I
Electronic commerce courselecture one. Pdf
Understanding_Digital_Forensics_Presentation.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

O auth how_to

  • 1. Authorization with OAuth Rob Richards October 22, 2009 cdatazone.org http://xri.net/=rob.richards
  • 2. Authentication • HTTP Authentication • Basic • Digest • TLS/SSL • WS-Security • Developer Keys • 3rd Party Authentication • Yahoo BBAuth • AOL OpenAuth
  • 3. OAuth An Open Protocol to allow Secure API Authorization
  • 4. Oauth is not OpenID Oauth Is Like OpenID
  • 6. OAuth OAuth is like a Valet Key
  • 7. OAuth OAuth is like a Hotel Keycard
  • 8. M as ter K ey 101 103 105 107 102 104 106 108
  • 9. Gues t K ey: Granting Acces s 101 103 105 107 102 104 106 108
  • 10. Gues t K ey: R evoking Acces s 101 103 105 107 102 104 106 108
  • 11. M as ter K ey M aintains Full Acces s 101 103 105 107 102 104 106 108
  • 13. OAuth and Netf ix l developer.netf ix.com l
  • 15. Netf ix API: Us er R es ources l
  • 16. Netf ix Applications ... and many more l
  • 17. Obtaining a C ons umer K ey / S ecret
  • 18. Obtaining a C ons umer K ey / S ecret
  • 19. 3-Leg g ed OAuth “The OAuth Dance”
  • 20. S tep 1: Obtaining a R eques t Token http://api.netfix.com/oauth/request_token Signed Request Request Token & Secret
  • 21. S tep 1: Obtaining a R eques t Token http://api.netfix.com/oauth/request_token? oauth_callback=http%3A%2F%2Fwww.example.com%2Fcallback &oauth_consumer_key=1234567890123456789012345 &oauth_nonce=60a3f1c4a18c2a68d8cb216f46bceb4ad7dff32e &oauth_signature=SB%2BjBrcHkQRgMP8XKVyps3rw6Xo%3D &oauth_signature_method=HMAC-SHA1 &oauth_timestamp=1255631744 &oauth_version=1.0
  • 22. C alculating The S ig nature Calculate Base String <HTTP method>&<canonicalized URL path>&<parameters> GET&http%3A%2F%2Fapi.netfix.com%2Foauth %2Frequest_token&oauth_callback%3Dhttp%253A%252F %252Fwww.example.com%252Fcallback %26oauth_consumer_key %3D1234567890123456789012345%26oauth_nonce %3D3eb496472d2a46ceb71d65fc1b7341ae359f932c %26oauth_signature_method%3DHMAC- SHA1%26oauth_timestamp %3D1255631744%26oauth_version%3D1.0
  • 23. C alculating The S ig nature • Parameters are collected, sorted and concatenated into a normalized string • Parameters in the OAuth HTTP Authorization header excluding the realm parameter. • Parameters in the HTTP POST request body (with a content-type of application/x-www-form-urlencoded). • HTTP GET parameters added to the URLs in the query part (as defned by [RFC3986] section 3) • The oauth_signature parameter MUST be excluded • Parameters are sorted by name, using lexicographical byte value ordering
  • 24. C alculating The S ig nature (Authorization Header) GET /oauth/request_token HTTP/1.1 User-Agent: PECL::HTTP/1.6.4 (PHP/5.2.10) Host: api.netfix.com Accept: */* Authorization: OAuth oauth_callback="http%3A%2F %2Fwww.example.com%2Fcallback", oauth_consumer_key="1234567890123456789012345", oauth_nonce="60a3f1c4a18c2a68d8cb216f46bceb4ad7dff32e", oauth_signature="SB%2BjBrcHkQRgMP8XKVyps3rw6Xo%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1255631744", oauth_version="1.0"
  • 25. C alculating The S ig nature Create Secret <consumer secret>&<token secret> 1234567890123456789012345& Sign Base String using algorithm specifed HMAC(1234567890123456789012345&,<Base String>) Base64 encode then URL encode result: oauth_signature=SB%2BjBrcHkQRgMP8XKVyps3rw6Xo%3D
  • 26. S tep 1: Obtaining a R eques t Token (R es pons e) oauth_token=bqba9rku48yacfatjxjw3fkc &oauth_token_secret=EZ2mBk6rC2vZ &oauth_callback_confrmed=true &login_url=https%3A%2F%2Fapi-user.netfix.com%2Foauth %2Flogin
  • 27. S tep 2: Us er Authentication Determined by needs of Service Provider https://api-user.netfix.com/oauth/login?oauth_token=bqba9rku48yacfatjxjw3fkc
  • 28. S tep 2: Us er Authentication Determined by needs of Service Provider Callback oauth_token=bqba9rku48yacfatjxjw3fkc&oauth_verifer=abcdefg
  • 29. S tep 2: Us er Authentication Determined by needs of Service Provider
  • 30. Oauth Trus t A Matter Of Trust
  • 31. S tep 3: Obtaining an Acces s Token http://api.netfix.com/oauth/access_token Signed Request Access Token & Secret
  • 32. S tep 3: Obtaining an Acces s Token http://api.netfix.com/oauth/access_token? oauth_consumer_key=1234567890123456789012345 &oauth_nonce=0a5ebd08b88e3ec7d7e27c7fb8735c7aa9a7229a &oauth_signature=FXDtkQtg6u42YYipJhBgCBvVXHI%3D &oauth_signature_method=HMAC-SHA1 &oauth_timestamp=1255704433 &oauth_token=bqba9rku48yacfatjxjw3fkc &oauth_verifer=abcdefg &oauth_version=1.0
  • 33. C alculating The S ig nature Calculate Base String <HTTP method>&<canonicalized URL path>&<parameters> GET&http%3A%2F%2Fapi.netfix.com%2Foauth %2Faccess_token&oauth_consumer_key %3D1234567890123456789012345%26oauth_nonce %3D0a5ebd08b88e3ec7d7e27c7fb8735c7aa9a7229a %26oauth_signature_method%3DHMAC- SHA1%26oauth_timestamp%3D1255704433%26oauth_token %3Dbqba9rku48yacfatjxjw3fkc%26oauth_verifer%3Dabcdefg %26oauth_version%3D1.0
  • 34. C alculating The S ig nature Create Secret <consumer secret>&<token secret> 1234567890123456789012345&EZ2mBk6rC2vZ Sign Base String using algorithm specifed HMAC(1234567890123456789012345&EZ2mBk6rC2vZ,<Base String>) Base64 encode then URL encode result: oauth_signature=eCLuRjEhSB%2BFImlN8sqrusPd9AE%3D
  • 35. S tep 3: Obtaining an Acces s Token (R es pons e) oauth_token=5432109876543210987654321 &user_id=123myuserid456 &oauth_token_secret=543210987654321
  • 36. Acces s ing R es ources http://api.netfix.com/<path to resource> Signed Request Resource
  • 37. Acces s ing R es ources http://api.netfix.com/users/123myuserid456/queues? oauth_consumer_key=1234567890123456789012345 &oauth_nonce=0c36fbefee5af0316687c6984a32c0184526e7b2 &oauth_signature=IXkzzAhF9hnsFIeftxEdfG0nx1s%3D &oauth_signature_method=HMAC-SHA1 &oauth_timestamp=1255712310 &oauth_token=5432109876543210987654321 &oauth_version=1.0 &v=1.5
  • 38. C alculating The S ig nature Create Secret <consumer secret>&<token secret> 1234567890123456789012345&543210987654321 Sign Base String using algorithm specifed HMAC(1234567890123456789012345&543210987654321,<Base String>) Base64 encode then URL encode result: oauth_signature=IXkzzAhF9hnsFIeftxEdfG0nx1s%3D
  • 39. Acces s ing R es ources (R es pons e) <?xml version="1.0" standalone="yes"?> <resource> <link href="http://api.netfix.com/users/123myuserid456/queues/disc" rel="http://schemas.netfix.com/queues.disc" title="disc queue" /> <link href="http://api.netfix.com/users/123myuserid456/queues/instant" rel="http://schemas.netfix.com/queues.instant" title="instant queue" /> </resource>
  • 40. Acces s ing R es ources (R es pons e)
  • 41. M anag ing Acces s Tokens
  • 42. 2-Leg g ed OAuth • No Dance Required • Only Consumer Key and Secret required • Application making requests on its own behalf • Direct Access / No Delegation • Replacement for HTTP Basic Authentication • Sign request just as if they were requests for Request Tokens
  • 43. Ques tions ? Authorization with OAuth Rob Richards http://xri.net/=rob.richards www.cdatazone.org