SlideShare a Scribd company logo
1 of 14
Prepared by – Kumaresh Chandra Baruri
Software Engineer
 Oauth 2 delegates user authentication to the service that holds user account. Like-
 Gmail account provided by Google service.
 FB account by Facebook service.
 It authorizes third-party applications to access that user account. Like- a web
application is using Oauth 2 to login and consequently to use account info.
 OAuth 2 provides authorization flows for web and desktop applications, as well as
mobile devices.
OAuth 2 is an authorization framework that enables applications
— such as Facebook, GitHub, Google or others — to obtain
limited access to user accounts on an HTTP service.
1. Resource Owner: The resource owner is the user who authorizes an
application to access their account. The application’s access to the
user’s account is limited to the scope of the authorization granted
(e.g. read or write access)
2. Client: The client is the application that wants to access the user’s
account. Before it may do so, it must be authorized by the user, and
the authorization must be validated by the API.
3. Resource Server: The resource server hosts the protected user
accounts.
4. Authorization Server: The authorization server verifies the identity of
the user then issues access tokens to the application.
There are four different roles in OAUTH 2.
The following information is required to register the application-
1. Application Name
2. Application Website
3. Redirect URI or Callback URL where the service will redirect the user
after they authorize (or deny).
App means the one which is going to use Oauth 2 for
authorization. Before using Oauth 2 with your
application, developer must register the application with
the service like- Google, FB etc.
1. Client ID
 Publicly exposed string that is used by the service API to identify the
application.
 Used to build authorization URLs that are presented to users.
2. Client Secret
 Used to authenticate the identity of the application to the service API.
 It must be kept private between the application and the API.
After registering the app, the service will issue client
credentials in the form of a client identifier and a client
secret.
1. Authorization Code: used with server-side Applications.
2. Client Credentials: used with Applications that have API access.
3. Device Code: used for devices that lack browsers or have input
limitations.
OAuth 2 supports three primary grant types.
*** This article covers Auth Code based authorization
Application
(Client)
Auth Server
(Service API)
User
(Resource
owner)
User-agent
(Web browser)
1. User authorization request
2. User authorizes Application
3. Authorization code grant
4. Access token request
5. Access token grant
1. **https://cloud.domain.com/v1/oauth/authorize**: the API authorization endpoint
2. client_id=client_id: the application’s client ID (how the API identifies the
application)
3. redirect_uri=CALLBACK_URL: where the service redirects the user-agent after
an authorization code is granted
4. response_type=code: specifies that your application is requesting an
authorization code grant
5. scope=read: specifies the level of access that the application is requesting
Link:
https://cloud.domain.com/v1/oauth/authorize?response_type=code&client_id=CLIE
NT_ID&redirect_uri=CALLBACK_URL&scope=read
1. The user will be prompted by the service to authorize or deny the application
access to their account.
2. Authorize application:
3. The application is requesting read access.
4. The user accepts and permission provided.
When the user clicks the link, button they must first log in to the service to
authenticate their identity
1. Service redirects the user-agent to the application redirect URI along with
Auth Code.
2. Redirection link-
https://app-domain.com/callback?code=AUTHORIZATION_CODE
When the use authorizes the application-
1. Requests an access token from the API by passing the authorization code
along with authentication details, including the client secret, to the API token
endpoint.
2. Access token request would be like-
https://cloud.domain.com/v1/oauth/token?client_id=CLIENT_ID&client_secret=
CLIENT_SECRET&grant_type=authorization_code&code=AUTHORIZATIO
N_CODE&redirect_uri=CALLBACK_URL
After receiving auth code, app
1. API service sends response with –
a) Access Token.
b) Refresh Token.
2. Response will be like this –
In case of valid auth code-
1. https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2
2. https://www.slideshare.net/kumareshbaruri/authentication-and-single-sign-on-sso
3. https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
Introduction to OAuth2

More Related Content

Similar to Introduction to OAuth2

OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
OAuth 2.0  - The fundamentals, the good , the bad, technical primer and commo...OAuth 2.0  - The fundamentals, the good , the bad, technical primer and commo...
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...Good Dog Labs, Inc.
 
Intro to OAuth2 and OpenID Connect
Intro to OAuth2 and OpenID ConnectIntro to OAuth2 and OpenID Connect
Intro to OAuth2 and OpenID ConnectLiamWadman
 
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013Aaron Parecki
 
OAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID ConnectOAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID ConnectJacob Combs
 
Implementing open authentication_in_your_app
Implementing open authentication_in_your_appImplementing open authentication_in_your_app
Implementing open authentication_in_your_appNuhil Mehdy
 
Extended Security with WSO2 API Management Platform
Extended Security with WSO2 API Management PlatformExtended Security with WSO2 API Management Platform
Extended Security with WSO2 API Management PlatformWSO2
 
Protecting your APIs with OAuth 2.0
Protecting your APIs with OAuth 2.0Protecting your APIs with OAuth 2.0
Protecting your APIs with OAuth 2.0Ubisecure
 
OAuth2 Introduction
OAuth2 IntroductionOAuth2 Introduction
OAuth2 IntroductionArpit Suthar
 
Microsoft Graph API Delegated Permissions
Microsoft Graph API Delegated PermissionsMicrosoft Graph API Delegated Permissions
Microsoft Graph API Delegated PermissionsStefan Weber
 
Silicon Valley Code Camp 2009: OAuth: What, Why and How
Silicon Valley Code Camp 2009: OAuth: What, Why and HowSilicon Valley Code Camp 2009: OAuth: What, Why and How
Silicon Valley Code Camp 2009: OAuth: What, Why and HowManish Pandit
 
.NET Core, ASP.NET Core Course, Session 19
 .NET Core, ASP.NET Core Course, Session 19 .NET Core, ASP.NET Core Course, Session 19
.NET Core, ASP.NET Core Course, Session 19aminmesbahi
 

Similar to Introduction to OAuth2 (20)

OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
OAuth 2.0  - The fundamentals, the good , the bad, technical primer and commo...OAuth 2.0  - The fundamentals, the good , the bad, technical primer and commo...
OAuth 2.0 - The fundamentals, the good , the bad, technical primer and commo...
 
Oauth 2.0
Oauth 2.0Oauth 2.0
Oauth 2.0
 
Lecture #25 : Oauth 2.0
Lecture #25 : Oauth 2.0Lecture #25 : Oauth 2.0
Lecture #25 : Oauth 2.0
 
Intro to OAuth2 and OpenID Connect
Intro to OAuth2 and OpenID ConnectIntro to OAuth2 and OpenID Connect
Intro to OAuth2 and OpenID Connect
 
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
Using ArcGIS with OAuth 2.0 - Esri DevSummit Dubai 2013
 
OAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID ConnectOAuth 2.0 and OpenID Connect
OAuth 2.0 and OpenID Connect
 
Implementing open authentication_in_your_app
Implementing open authentication_in_your_appImplementing open authentication_in_your_app
Implementing open authentication_in_your_app
 
Extended Security with WSO2 API Management Platform
Extended Security with WSO2 API Management PlatformExtended Security with WSO2 API Management Platform
Extended Security with WSO2 API Management Platform
 
Authentication and single sign on (sso)
Authentication and single sign on (sso)Authentication and single sign on (sso)
Authentication and single sign on (sso)
 
Protecting your APIs with OAuth 2.0
Protecting your APIs with OAuth 2.0Protecting your APIs with OAuth 2.0
Protecting your APIs with OAuth 2.0
 
OAuth
OAuthOAuth
OAuth
 
OAuth2 Introduction
OAuth2 IntroductionOAuth2 Introduction
OAuth2 Introduction
 
Microsoft Graph API Delegated Permissions
Microsoft Graph API Delegated PermissionsMicrosoft Graph API Delegated Permissions
Microsoft Graph API Delegated Permissions
 
OAuth Tokens
OAuth TokensOAuth Tokens
OAuth Tokens
 
Securing api with_o_auth2
Securing api with_o_auth2Securing api with_o_auth2
Securing api with_o_auth2
 
OAuth in the Wild
OAuth in the WildOAuth in the Wild
OAuth in the Wild
 
Silicon Valley Code Camp 2009: OAuth: What, Why and How
Silicon Valley Code Camp 2009: OAuth: What, Why and HowSilicon Valley Code Camp 2009: OAuth: What, Why and How
Silicon Valley Code Camp 2009: OAuth: What, Why and How
 
OAuth v2.0 demo
OAuth v2.0 demoOAuth v2.0 demo
OAuth v2.0 demo
 
.NET Core, ASP.NET Core Course, Session 19
 .NET Core, ASP.NET Core Course, Session 19 .NET Core, ASP.NET Core Course, Session 19
.NET Core, ASP.NET Core Course, Session 19
 
OAuth2 Presentaion
OAuth2 PresentaionOAuth2 Presentaion
OAuth2 Presentaion
 

More from Kumaresh Chandra Baruri

More from Kumaresh Chandra Baruri (9)

Introduction to git, a version control system
Introduction to git, a version control systemIntroduction to git, a version control system
Introduction to git, a version control system
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
 
Fundamentasl of DFD
Fundamentasl of DFDFundamentasl of DFD
Fundamentasl of DFD
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Variations of git merging
Variations of git mergingVariations of git merging
Variations of git merging
 
Git branching policy and review comment's prefix
Git branching policy and review comment's prefixGit branching policy and review comment's prefix
Git branching policy and review comment's prefix
 
Introduction to flutter's basic concepts
Introduction to flutter's basic conceptsIntroduction to flutter's basic concepts
Introduction to flutter's basic concepts
 
WEB API Gateway
WEB API GatewayWEB API Gateway
WEB API Gateway
 
Model based testing using finite state machine(FSM)
Model based testing using finite state machine(FSM)Model based testing using finite state machine(FSM)
Model based testing using finite state machine(FSM)
 

Recently uploaded

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 

Recently uploaded (20)

Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 

Introduction to OAuth2

  • 1. Prepared by – Kumaresh Chandra Baruri Software Engineer
  • 2.  Oauth 2 delegates user authentication to the service that holds user account. Like-  Gmail account provided by Google service.  FB account by Facebook service.  It authorizes third-party applications to access that user account. Like- a web application is using Oauth 2 to login and consequently to use account info.  OAuth 2 provides authorization flows for web and desktop applications, as well as mobile devices. OAuth 2 is an authorization framework that enables applications — such as Facebook, GitHub, Google or others — to obtain limited access to user accounts on an HTTP service.
  • 3. 1. Resource Owner: The resource owner is the user who authorizes an application to access their account. The application’s access to the user’s account is limited to the scope of the authorization granted (e.g. read or write access) 2. Client: The client is the application that wants to access the user’s account. Before it may do so, it must be authorized by the user, and the authorization must be validated by the API. 3. Resource Server: The resource server hosts the protected user accounts. 4. Authorization Server: The authorization server verifies the identity of the user then issues access tokens to the application. There are four different roles in OAUTH 2.
  • 4. The following information is required to register the application- 1. Application Name 2. Application Website 3. Redirect URI or Callback URL where the service will redirect the user after they authorize (or deny). App means the one which is going to use Oauth 2 for authorization. Before using Oauth 2 with your application, developer must register the application with the service like- Google, FB etc.
  • 5. 1. Client ID  Publicly exposed string that is used by the service API to identify the application.  Used to build authorization URLs that are presented to users. 2. Client Secret  Used to authenticate the identity of the application to the service API.  It must be kept private between the application and the API. After registering the app, the service will issue client credentials in the form of a client identifier and a client secret.
  • 6. 1. Authorization Code: used with server-side Applications. 2. Client Credentials: used with Applications that have API access. 3. Device Code: used for devices that lack browsers or have input limitations. OAuth 2 supports three primary grant types. *** This article covers Auth Code based authorization
  • 7. Application (Client) Auth Server (Service API) User (Resource owner) User-agent (Web browser) 1. User authorization request 2. User authorizes Application 3. Authorization code grant 4. Access token request 5. Access token grant
  • 8. 1. **https://cloud.domain.com/v1/oauth/authorize**: the API authorization endpoint 2. client_id=client_id: the application’s client ID (how the API identifies the application) 3. redirect_uri=CALLBACK_URL: where the service redirects the user-agent after an authorization code is granted 4. response_type=code: specifies that your application is requesting an authorization code grant 5. scope=read: specifies the level of access that the application is requesting Link: https://cloud.domain.com/v1/oauth/authorize?response_type=code&client_id=CLIE NT_ID&redirect_uri=CALLBACK_URL&scope=read
  • 9. 1. The user will be prompted by the service to authorize or deny the application access to their account. 2. Authorize application: 3. The application is requesting read access. 4. The user accepts and permission provided. When the user clicks the link, button they must first log in to the service to authenticate their identity
  • 10. 1. Service redirects the user-agent to the application redirect URI along with Auth Code. 2. Redirection link- https://app-domain.com/callback?code=AUTHORIZATION_CODE When the use authorizes the application-
  • 11. 1. Requests an access token from the API by passing the authorization code along with authentication details, including the client secret, to the API token endpoint. 2. Access token request would be like- https://cloud.domain.com/v1/oauth/token?client_id=CLIENT_ID&client_secret= CLIENT_SECRET&grant_type=authorization_code&code=AUTHORIZATIO N_CODE&redirect_uri=CALLBACK_URL After receiving auth code, app
  • 12. 1. API service sends response with – a) Access Token. b) Refresh Token. 2. Response will be like this – In case of valid auth code-