SlideShare a Scribd company logo
OAuth 2.0 for developers - the
technology you need but never
really learned
Mikkel Flindt Heisterberg
OnTime® by IntraVision
Agenda
• The problem we are trying to solve
• Demo (OAuth for users i.e. almost real people)
• The flow…
• OAuth for administrators
• OAuth for developers i.e. real people
• Demo w/ code
• Q&A
Mikkel Flindt Heisterberg
Twitter: @lekkim
E-mail: mfh@intravision.dk
http://lekkimworld.com
http://slideshare.net/lekkim
The problem we are trying to solve
The problem we are trying to solve
Give me your Social
site username and
password and we can
play…
The problem we are trying to solve
Doesn’t really trust that
shiny new site – or IBM
Connections for that
matter…
Give me your Social
site username and
password and we can
play…
The problem we are trying to solve
I support OAuth 2.0
and don’t want your
credentials – just
authorize me to work
on your behalf…
The problem we are trying to solve
1
2
3
it’s about letting a service
access user data without
knowing the users credentials...
- or without the user being there...
Introduction to OAuth 2.0 - the technology you need but never really learned
Demo safety
it’s not as simple as that
but almost...
The flow…
CLIENT
PROVIDER
USER
1
The flow…
CLIENT
PROVIDER
USER
2
The flow…
CLIENT
PROVIDER
USER
3
The flow…
CLIENT
PROVIDER
USER
4
The flow…
CLIENT
PROVIDER
USER
5
The flow…
CLIENT
PROVIDER
USER
6
The flow…
CLIENT
PROVIDER
USER
7
The flow…
CLIENT
PROVIDER
USER
8
The flow…
CLIENT
PROVIDER
USER
9
but less cartoony and with
real words this time...
1) User accesses site and logs in
CLIENT
PROVIDER
USER
1
2) The site checks to see if it has Tokens for the Provider
in its credential store
CLIENT
PROVIDER
USER
2
3) The site sends a redirection to the client telling it to
go authorize it at the Provider. The URL contains the
Client redirect_uri and client_id
CLIENT
PROVIDER
USER
3
4) The user use the redirect URL and go the Provider
and logs in if not already logged in. Then he authorizes
the Client
CLIENT
PROVIDER
USER
4
5) The Provider returns a time limited
authorization_code in a redirection URL to the user
CLIENT
PROVIDER
USER
5
6) The User sends the authorization_code to the Client
CLIENT
PROVIDER
USER
6
7) Out-of-band the Client sends the authorization_code,
it’s client_id, redirect_uri and secret to the Provider
CLIENT
PROVIDER
USER
7
8) The Provider exchange the authorization_code for a
short lived access_token (yellow) and a longer lived
refresh_token (blue)
CLIENT
PROVIDER
USER
8
9) When the User now access the site it can use the
access_token to work as the User. Even if the user is not
there i.e. not logged into the site…
CLIENT
PROVIDER
USER
9
If not you should ask now…
Application registration
WSADMIN
COMING UP
On-premises
OAuth for administrators
•IBM Connections use the built in OAuth
provider from WebSphere Application
Server
•Administrators are responsible for
registering the app with the OAuth
provider
•You use – you guessed it – wsadmin
commands to do it…
On-premises
OAuth for administrators
execfile(”oauthAdmin.py”)
OAuthApplicationRegistrationService.addApplication(
”myapp1”, ”My App1", "https://www.renovations.com/oauth/redirect")
OAuthApplicationRegistrationService.browseApplications()[{display_name=
My App1, client_id=myapp1, client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxx,
redirect_uri=
https://www.renovations.com/oauth/redirect}]
OAuthApplicationRegistrationService.deleteApplication(”myapp1”)
The application with the id myapp1 was deleted successfully.
https://www-
01.ibm.com/support/knowledgecenter/SSYGQH_5.0.0/admin/admin/r_admin_co
mmon_oauth_manage_list.dita
On-premises
IBM Connections Cloud
Cloud
IBM Connections Cloud
Cloud
I’M A
DEVELOPER
Introduction to OAuth 2.0 - the technology you need but never really learned
OAuth for developers
Generate the authorization redirection URL and
have the user visit it. Suggest it’s done in a
separate window.
Syntax
https://<hostname>/oauth2/endpoint/connectionsProvider/authorize?response_ty
pe=code&client_id=<client_id>
&callback_uri=<callback_uri>
Example
https://social.example.com/oauth2/endpoint/connectionsProvider/authorize?resp
onse_type=code&client_id=myapp1&callback_uri=
https://myapp.shinysite.com/oauth20_cb
OAuth for developers
Generate the authorization redirection URL and
have the user visit it. Suggest it’s done in a
separate window.
Syntax
https://<hostname>/oauth2/endpoint/connectionsProvider/authorize?response_ty
pe=code&client_id=<client_id>
&callback_uri=<callback_uri>
Example
https://social.example.com/oauth2/endpoint/connectionsProvider/authorize?resp
onse_type=code&client_id=myapp1&callback_uri=
https://myapp.shinysite.com/oauth20_cb
Must match exactly what the Provider have on record…
OAuth for developers
The user logs in to the Provider (if not already) and
authorizes your app… Hopefully...
OAuth for developers
The Provider sends back a redirection URL to the
User containing an authorization code causing
the User to send it to the Client
Syntax
https://<client_redirection_uri>?code=<authorization_code>
https://<client_redirection_uri>?oauth_error=<error_code>
Example
https://myapp.shinysite.com/oauth20_cb
?code=user_specific_auth_code
OAuth for developers
Client POST’s the authorization code, client ID,
redirection URI and client secret to the Provider
out-of-band (server to server, not through User)
Syntax
POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0
Host: <hostname>
Content-Length: <length>
Connection: Close
client_secret=<client_secret>&client_id=<client_id>&grant_type=authorization_code&code=<auth_code
>&callback_uri=<callback_uri>
Example
POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0
Host: social.example.com
Content-Length: 161
Connection: Close
client_secret=my_secret_string&client_id=myapp1
&grant_type=authorization_code&code=user_specific_auth_code
&callback_uri=https://myapp.shinysite.com/oauth20_cb
OAuth for developers
Provider responds with (JSON) response with
access token, refresh token and expiry info. It
would be wise that the client saves the tokens…
Example
{
"access_token”: "d86o7UP0gj2c...GVzTPADsFv7”,
"token_type": "Bearer",
"expires_in": 43200,
"scope": "",
"refresh_token": "EWcVt5uaaXC9Pc...pTTgvrLRrs56gR”
}
Response format is Provider specific i.e. IBM Connections Cloud
returns tokens in plain text format…
OAuth for developers
To make requests on behalf of the User the Client
needs to set the access token in an Authorization
header
Example
GET /connections/opensocial/oauth/rest
/activitystreams/@me/@all/@all HTTP/1.0
Host: social.example.com
Authorization: Bearer d86o7UP0gj2c...GVzTPADsFv7
Connection: Close
If the Client use an access token and receive a 401 back from the Provider it
should attempt to refresh the access token.
OAuth for developers
You can refresh the tokens i.e. if a call using the access token
returns a 401 from the Provider by using the refresh_token. If that
also fails the user probably revoked your authorization.
Syntax
POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0
Host: <hostname>
Content-Length: <length>
Connection: Close
client_secret=<client_secret>&client_id=<client_id>&grant_type=refresh_token&refresh_token=<refresh_
token>
Example
POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0
Host: social.example.com
Content-Length: 104
Connection: Close
client_secret=my_secret_string&client_id=myapp1
&grant_type=refresh_token&refresh_token=my_refresh_token
Demo
Mikkel Flindt Heisterberg
Twitter: @lekkim
E-mail: mfh@intravision.dk
http://lekkimworld.com
http://slideshare.net/lekkim
Dev04 – XPages & Office 365 by Marky Roden

More Related Content

Viewers also liked (20)

PPTX
Securing IaaS Applications
Bitglass
 
PPTX
Introduction to OAuth 2.0 - Part 1
Nabeel Yoosuf
 
PDF
engage 2016 - Get ready for moving from Java 6 to Java 8 - Now!
René Winkelmeyer
 
PPT
OAuth 2.0 and OpenId Connect
Saran Doraiswamy
 
PDF
OAuth 2.0 & OpenID Connect @ OpenSource Conference 2011 Tokyo #osc11tk
Nov Matake
 
PPTX
Deep Dive DMG (september update)
Jean-Pierre Riehl
 
PDF
'Embedding' a meta state machine
emBO_Conference
 
PPTX
Authorization for Internet of Things using OAuth 2.0
Hannes Tschofenig
 
PDF
The Future is Now: The ForgeRock Identity Platform, Early 2017 Release
ForgeRock
 
PDF
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
Java User Group Latvia
 
PDF
Implementing OAuth
leahculver
 
PDF
NFV SDN for carriers
Marie-Paule Odini
 
PPTX
NIC 2017 Azure AD Identity Protection and Conditional Access: Using the Micro...
Morgan Simonsen
 
PDF
Java secure development part 1
Rafel Ivgi
 
PPTX
Mit 2014 introduction to open id connect and o-auth 2
Justin Richer
 
PPTX
OpenID Connect - a simple[sic] single sign-on & identity layer on top of OAut...
Brian Campbell
 
PDF
OAuth for your API - The Big Picture
Apigee | Google Cloud
 
PDF
Introduction to OpenID Connect
Nat Sakimura
 
PDF
OAuth - Open API Authentication
leahculver
 
PPTX
An Introduction to OAuth 2
Aaron Parecki
 
Securing IaaS Applications
Bitglass
 
Introduction to OAuth 2.0 - Part 1
Nabeel Yoosuf
 
engage 2016 - Get ready for moving from Java 6 to Java 8 - Now!
René Winkelmeyer
 
OAuth 2.0 and OpenId Connect
Saran Doraiswamy
 
OAuth 2.0 & OpenID Connect @ OpenSource Conference 2011 Tokyo #osc11tk
Nov Matake
 
Deep Dive DMG (september update)
Jean-Pierre Riehl
 
'Embedding' a meta state machine
emBO_Conference
 
Authorization for Internet of Things using OAuth 2.0
Hannes Tschofenig
 
The Future is Now: The ForgeRock Identity Platform, Early 2017 Release
ForgeRock
 
Modern Security with OAuth 2.0 and JWT and Spring by Dmitry Buzdin
Java User Group Latvia
 
Implementing OAuth
leahculver
 
NFV SDN for carriers
Marie-Paule Odini
 
NIC 2017 Azure AD Identity Protection and Conditional Access: Using the Micro...
Morgan Simonsen
 
Java secure development part 1
Rafel Ivgi
 
Mit 2014 introduction to open id connect and o-auth 2
Justin Richer
 
OpenID Connect - a simple[sic] single sign-on & identity layer on top of OAut...
Brian Campbell
 
OAuth for your API - The Big Picture
Apigee | Google Cloud
 
Introduction to OpenID Connect
Nat Sakimura
 
OAuth - Open API Authentication
leahculver
 
An Introduction to OAuth 2
Aaron Parecki
 

Similar to Introduction to OAuth 2.0 - the technology you need but never really learned (20)

PDF
OAuth 2.0 for developers – the technology you need but never really learned
LetsConnect
 
PDF
Stateless Auth using OAUTH2 & JWT
Mobiliya
 
PDF
Stateless Auth using OAuth2 & JWT
Gaurav Roy
 
PPTX
Devteach 2017 OAuth and Open id connect demystified
Taswar Bhatti
 
PDF
OAuth In The Real World : 10 actual implementations you can't guess
Mehdi Medjaoui
 
PPTX
OAuth with Salesforce - Demystified
Calvin Noronha
 
PPT
Implementing OpenID for Your Social Networking Site
David Keener
 
PPTX
Oauth 2.0 Introduction and Flows with MuleSoft
shyamraj55
 
PDF
Ember Authentication and Authorization with Torii
Cory Forsyth
 
PPTX
O auth2 with angular js
Bixlabs
 
PPTX
Intro to OAuth2 and OpenID Connect
LiamWadman
 
PPTX
Oauth2 and OWSM OAuth2 support
Gaurav Sharma
 
PPTX
Lecture 20101124
Anderson Liang
 
PDF
Mobile Authentication - Onboarding, best practices & anti-patterns
Pieter Ennes
 
PPTX
OAuth 2.0
Mihir Shah
 
PDF
Oauth Nightmares Abstract OAuth Nightmares
Nino Ho
 
PPTX
OAuth and Open-id
Parisa Moosavinezhad
 
PPTX
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
MysoreMuleSoftMeetup
 
PDF
OAuth for QuickBooks Online REST Services
Intuit Developer
 
PPTX
OAuth in the Wild
Victor Rentea
 
OAuth 2.0 for developers – the technology you need but never really learned
LetsConnect
 
Stateless Auth using OAUTH2 & JWT
Mobiliya
 
Stateless Auth using OAuth2 & JWT
Gaurav Roy
 
Devteach 2017 OAuth and Open id connect demystified
Taswar Bhatti
 
OAuth In The Real World : 10 actual implementations you can't guess
Mehdi Medjaoui
 
OAuth with Salesforce - Demystified
Calvin Noronha
 
Implementing OpenID for Your Social Networking Site
David Keener
 
Oauth 2.0 Introduction and Flows with MuleSoft
shyamraj55
 
Ember Authentication and Authorization with Torii
Cory Forsyth
 
O auth2 with angular js
Bixlabs
 
Intro to OAuth2 and OpenID Connect
LiamWadman
 
Oauth2 and OWSM OAuth2 support
Gaurav Sharma
 
Lecture 20101124
Anderson Liang
 
Mobile Authentication - Onboarding, best practices & anti-patterns
Pieter Ennes
 
OAuth 2.0
Mihir Shah
 
Oauth Nightmares Abstract OAuth Nightmares
Nino Ho
 
OAuth and Open-id
Parisa Moosavinezhad
 
Configuring Single Sign-On (SSO) via Identity Management | MuleSoft Mysore Me...
MysoreMuleSoftMeetup
 
OAuth for QuickBooks Online REST Services
Intuit Developer
 
OAuth in the Wild
Victor Rentea
 
Ad

More from Mikkel Flindt Heisterberg (17)

PPTX
An Introduction to Lightning Web Components
Mikkel Flindt Heisterberg
 
PDF
BP205: There’s an API for that! Why and how to build on the IBM Connections P...
Mikkel Flindt Heisterberg
 
PPTX
IBM Connections 5 Gæstemodel
Mikkel Flindt Heisterberg
 
PPTX
There’s an API for that! Why and how to build on the IBM Connections PLATFORM
Mikkel Flindt Heisterberg
 
PDF
Social Connections VI Prague - An introduction to ibm connections as an appde...
Mikkel Flindt Heisterberg
 
ODP
BP309 Project Management Inside and Outside the Box
Mikkel Flindt Heisterberg
 
PDF
BP301 - An introduction to working with the activity stream
Mikkel Flindt Heisterberg
 
PPTX
An Introduction to Working With the Activity Stream
Mikkel Flindt Heisterberg
 
PPT
Creating a keystore for plugin signing the easy way
Mikkel Flindt Heisterberg
 
PDF
BP207 - Easy as pie creating widgets for ibm connections
Mikkel Flindt Heisterberg
 
PPTX
OnTime Partner Webinar September 2011
Mikkel Flindt Heisterberg
 
ODP
Plug yourself in and your app will never be the same (2 hr editon)
Mikkel Flindt Heisterberg
 
ODP
Plug yourself in and your app will never be the same (2 hour edition)
Mikkel Flindt Heisterberg
 
PPT
Lotusphere Comes To You 2011
Mikkel Flindt Heisterberg
 
PPTX
Lotus Community Call - 22 March 2011
Mikkel Flindt Heisterberg
 
ODP
Plug yourself in and your app will never be the same (1 hr edition)
Mikkel Flindt Heisterberg
 
PPTX
Lotus Notes Plugin Installation For Dummies
Mikkel Flindt Heisterberg
 
An Introduction to Lightning Web Components
Mikkel Flindt Heisterberg
 
BP205: There’s an API for that! Why and how to build on the IBM Connections P...
Mikkel Flindt Heisterberg
 
IBM Connections 5 Gæstemodel
Mikkel Flindt Heisterberg
 
There’s an API for that! Why and how to build on the IBM Connections PLATFORM
Mikkel Flindt Heisterberg
 
Social Connections VI Prague - An introduction to ibm connections as an appde...
Mikkel Flindt Heisterberg
 
BP309 Project Management Inside and Outside the Box
Mikkel Flindt Heisterberg
 
BP301 - An introduction to working with the activity stream
Mikkel Flindt Heisterberg
 
An Introduction to Working With the Activity Stream
Mikkel Flindt Heisterberg
 
Creating a keystore for plugin signing the easy way
Mikkel Flindt Heisterberg
 
BP207 - Easy as pie creating widgets for ibm connections
Mikkel Flindt Heisterberg
 
OnTime Partner Webinar September 2011
Mikkel Flindt Heisterberg
 
Plug yourself in and your app will never be the same (2 hr editon)
Mikkel Flindt Heisterberg
 
Plug yourself in and your app will never be the same (2 hour edition)
Mikkel Flindt Heisterberg
 
Lotusphere Comes To You 2011
Mikkel Flindt Heisterberg
 
Lotus Community Call - 22 March 2011
Mikkel Flindt Heisterberg
 
Plug yourself in and your app will never be the same (1 hr edition)
Mikkel Flindt Heisterberg
 
Lotus Notes Plugin Installation For Dummies
Mikkel Flindt Heisterberg
 
Ad

Recently uploaded (20)

PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
PDF
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PDF
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
PPTX
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
AEM User Group: India Chapter Kickoff Meeting
jennaf3
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
4K Video Downloader Plus Pro Crack for MacOS New Download 2025
bashirkhan333g
 
Top Agile Project Management Tools for Teams in 2025
Orangescrum
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
유니티에서 Burst Compiler+ThreadedJobs+SIMD 적용사례
Seongdae Kim
 
Change Common Properties in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Help for Correlations in IBM SPSS Statistics.pptx
Version 1 Analytics
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 

Introduction to OAuth 2.0 - the technology you need but never really learned

  • 1. OAuth 2.0 for developers - the technology you need but never really learned Mikkel Flindt Heisterberg OnTime® by IntraVision
  • 2. Agenda • The problem we are trying to solve • Demo (OAuth for users i.e. almost real people) • The flow… • OAuth for administrators • OAuth for developers i.e. real people • Demo w/ code • Q&A Mikkel Flindt Heisterberg Twitter: @lekkim E-mail: [email protected] http://lekkimworld.com http://slideshare.net/lekkim
  • 3. The problem we are trying to solve
  • 4. The problem we are trying to solve Give me your Social site username and password and we can play…
  • 5. The problem we are trying to solve Doesn’t really trust that shiny new site – or IBM Connections for that matter… Give me your Social site username and password and we can play…
  • 6. The problem we are trying to solve I support OAuth 2.0 and don’t want your credentials – just authorize me to work on your behalf…
  • 7. The problem we are trying to solve 1 2 3
  • 8. it’s about letting a service access user data without knowing the users credentials... - or without the user being there...
  • 11. it’s not as simple as that but almost...
  • 21. but less cartoony and with real words this time...
  • 22. 1) User accesses site and logs in CLIENT PROVIDER USER 1
  • 23. 2) The site checks to see if it has Tokens for the Provider in its credential store CLIENT PROVIDER USER 2
  • 24. 3) The site sends a redirection to the client telling it to go authorize it at the Provider. The URL contains the Client redirect_uri and client_id CLIENT PROVIDER USER 3
  • 25. 4) The user use the redirect URL and go the Provider and logs in if not already logged in. Then he authorizes the Client CLIENT PROVIDER USER 4
  • 26. 5) The Provider returns a time limited authorization_code in a redirection URL to the user CLIENT PROVIDER USER 5
  • 27. 6) The User sends the authorization_code to the Client CLIENT PROVIDER USER 6
  • 28. 7) Out-of-band the Client sends the authorization_code, it’s client_id, redirect_uri and secret to the Provider CLIENT PROVIDER USER 7
  • 29. 8) The Provider exchange the authorization_code for a short lived access_token (yellow) and a longer lived refresh_token (blue) CLIENT PROVIDER USER 8
  • 30. 9) When the User now access the site it can use the access_token to work as the User. Even if the user is not there i.e. not logged into the site… CLIENT PROVIDER USER 9
  • 31. If not you should ask now…
  • 34. OAuth for administrators •IBM Connections use the built in OAuth provider from WebSphere Application Server •Administrators are responsible for registering the app with the OAuth provider •You use – you guessed it – wsadmin commands to do it… On-premises
  • 35. OAuth for administrators execfile(”oauthAdmin.py”) OAuthApplicationRegistrationService.addApplication( ”myapp1”, ”My App1", "https://www.renovations.com/oauth/redirect") OAuthApplicationRegistrationService.browseApplications()[{display_name= My App1, client_id=myapp1, client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxx, redirect_uri= https://www.renovations.com/oauth/redirect}] OAuthApplicationRegistrationService.deleteApplication(”myapp1”) The application with the id myapp1 was deleted successfully. https://www- 01.ibm.com/support/knowledgecenter/SSYGQH_5.0.0/admin/admin/r_admin_co mmon_oauth_manage_list.dita On-premises
  • 40. OAuth for developers Generate the authorization redirection URL and have the user visit it. Suggest it’s done in a separate window. Syntax https://<hostname>/oauth2/endpoint/connectionsProvider/authorize?response_ty pe=code&client_id=<client_id> &callback_uri=<callback_uri> Example https://social.example.com/oauth2/endpoint/connectionsProvider/authorize?resp onse_type=code&client_id=myapp1&callback_uri= https://myapp.shinysite.com/oauth20_cb
  • 41. OAuth for developers Generate the authorization redirection URL and have the user visit it. Suggest it’s done in a separate window. Syntax https://<hostname>/oauth2/endpoint/connectionsProvider/authorize?response_ty pe=code&client_id=<client_id> &callback_uri=<callback_uri> Example https://social.example.com/oauth2/endpoint/connectionsProvider/authorize?resp onse_type=code&client_id=myapp1&callback_uri= https://myapp.shinysite.com/oauth20_cb Must match exactly what the Provider have on record…
  • 42. OAuth for developers The user logs in to the Provider (if not already) and authorizes your app… Hopefully...
  • 43. OAuth for developers The Provider sends back a redirection URL to the User containing an authorization code causing the User to send it to the Client Syntax https://<client_redirection_uri>?code=<authorization_code> https://<client_redirection_uri>?oauth_error=<error_code> Example https://myapp.shinysite.com/oauth20_cb ?code=user_specific_auth_code
  • 44. OAuth for developers Client POST’s the authorization code, client ID, redirection URI and client secret to the Provider out-of-band (server to server, not through User) Syntax POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0 Host: <hostname> Content-Length: <length> Connection: Close client_secret=<client_secret>&client_id=<client_id>&grant_type=authorization_code&code=<auth_code >&callback_uri=<callback_uri> Example POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0 Host: social.example.com Content-Length: 161 Connection: Close client_secret=my_secret_string&client_id=myapp1 &grant_type=authorization_code&code=user_specific_auth_code &callback_uri=https://myapp.shinysite.com/oauth20_cb
  • 45. OAuth for developers Provider responds with (JSON) response with access token, refresh token and expiry info. It would be wise that the client saves the tokens… Example { "access_token”: "d86o7UP0gj2c...GVzTPADsFv7”, "token_type": "Bearer", "expires_in": 43200, "scope": "", "refresh_token": "EWcVt5uaaXC9Pc...pTTgvrLRrs56gR” } Response format is Provider specific i.e. IBM Connections Cloud returns tokens in plain text format…
  • 46. OAuth for developers To make requests on behalf of the User the Client needs to set the access token in an Authorization header Example GET /connections/opensocial/oauth/rest /activitystreams/@me/@all/@all HTTP/1.0 Host: social.example.com Authorization: Bearer d86o7UP0gj2c...GVzTPADsFv7 Connection: Close If the Client use an access token and receive a 401 back from the Provider it should attempt to refresh the access token.
  • 47. OAuth for developers You can refresh the tokens i.e. if a call using the access token returns a 401 from the Provider by using the refresh_token. If that also fails the user probably revoked your authorization. Syntax POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0 Host: <hostname> Content-Length: <length> Connection: Close client_secret=<client_secret>&client_id=<client_id>&grant_type=refresh_token&refresh_token=<refresh_ token> Example POST /oauth2/endpoint/connectionsProvider/token HTTP/1.0 Host: social.example.com Content-Length: 104 Connection: Close client_secret=my_secret_string&client_id=myapp1 &grant_type=refresh_token&refresh_token=my_refresh_token
  • 48. Demo
  • 49. Mikkel Flindt Heisterberg Twitter: @lekkim E-mail: [email protected] http://lekkimworld.com http://slideshare.net/lekkim Dev04 – XPages & Office 365 by Marky Roden