{"id":27,"date":"2018-10-16T11:10:00","date_gmt":"2018-10-16T11:10:00","guid":{"rendered":""},"modified":"2020-07-25T21:53:14","modified_gmt":"2020-07-25T19:53:14","slug":"what-is-oauth-an-introduction-to-oauth-and-openid","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/what-is-oauth-an-introduction-to-oauth-and-openid\/","title":{"rendered":"What is OAuth? (An Introduction to OAuth and OpenID)"},"content":{"rendered":"<p>My name is Kindson and in this brief, lesson I would teach you the basics of OAuth 2.0 and OpenID. You will understand what they are and how they work very clearly.<\/p>\n<p><span style=\"-webkit-text-stroke-width: 0px; background-color: transparent; color: #555555; display: inline !important; float: none; font-family: 'segoe ui'; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: justify; text-decoration: none; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;\">You can watch the <\/span><a style=\"-webkit-text-stroke-width: 0px; background-color: transparent; color: #0066cc; font-family: &amp;quot; font-size: 18px; font-style: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: justify; text-decoration: underline; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;\" href=\"https:\/\/youtu.be\/mWbfDF14LVo\" target=\"_blank\" rel=\"noopener\">video explanation here<\/a><b><\/b><i><\/i><u><\/u><br \/>\n<b><\/b><i><\/i><u><\/u><br \/>\nWe would cover the following:<\/p>\n<ol>\n<li><a href=\"https:\/\/kindsonthegenius.com\/blog\/what-is-oauth-an-introduction-to-oauth-and-openid#t1\">What is OAuth?<\/a><\/li>\n<li><a href=\"https:\/\/kindsonthegenius.com\/blog\/what-is-oauth-an-introduction-to-oauth-and-openid#t2\">How OAuth Started<\/a><\/li>\n<li><a href=\"https:\/\/kindsonthegenius.com\/blog\/what-is-oauth-an-introduction-to-oauth-and-openid#t3\">OAuth Roles<\/a><\/li>\n<li><a href=\"https:\/\/kindsonthegenius.com\/blog\/what-is-oauth-an-introduction-to-oauth-and-openid#t4\">The OAuth Workflow<\/a><\/li>\n<li><a href=\"https:\/\/kindsonthegenius.com\/blog\/what-is-oauth-an-introduction-to-oauth-and-openid#t5\">Benefits of OAuth<\/a><\/li>\n<li><a href=\"https:\/\/kindsonthegenius.com\/blog\/what-is-oauth-an-introduction-to-oauth-and-openid#t6\">What is OpenID?<\/a><\/li>\n<\/ol>\n<p><ins style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-7041870931346451\" data-ad-slot=\"8227894917\"><\/ins><br \/>\n<b><\/b><\/p>\n<h3 id=\"t1\">1.0 What is OAuth<\/h3>\n<p>OAuth is an open standard for authorization which is used for access delegation. This means that users of a web application can grant an application access to their information without having to give them the login credentials.<br \/>\nOAuth provides a secure delegated access to the user&#8217;s information on behalf of the user.<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t2\">2.0 Why OAuth was Introduced<\/h3>\n<p>Before OAuth 1.0 protocol was published in 2010 access delegation was achieve by providing the third party application with your the login credentials(username and password). This creates a security challenge as there is no control of what the third party application can do with these details. OAuth was created to address this issue.<br \/>\nSo in 2010, the OAuth 1.0\u00a0 protocol was published after a group of researcher have worked on it for about 4 years.<\/p>\n<p><ins style=\"display: block; text-align: center;\" data-ad-layout=\"in-article\" data-ad-format=\"fluid\" data-ad-client=\"ca-pub-7041870931346451\" data-ad-slot=\"8227894917\"><\/ins><br \/>\n<b><\/b><\/p>\n<h3 id=\"t3\">3.0 OAuth Roles and Terminology<\/h3>\n<p>Before we explain how it works, it is necessary to understand the roles associated with the OAuth architecture<br \/>\n<i>Resource Owner:<\/i> This is the user of the resource or the owner of the account the application is requesting to access.<br \/>\n<i>Client<\/i>: This is the application the requests access to restricted resources.<br \/>\n<i>Authorization Server:<\/i> Holds account information and used for authorisation.<br \/>\n<i>Resource Server<\/i>: Contains secure information that need token to access<br \/>\n<i>Authorization Grant:<\/i> The initial code sent to the requesting application initially. The is the same as the authorization code and is passed through the front channel(browser)<br \/>\n<i>Redirect URI:<\/i> This is the URI that the would be redirected to after the authorisation grant have been given to the application.<br \/>\n<i>Access Token<\/i>: The token that is sent to the application and can be used to access resources.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t4\">4.0 The OAuth Workflow<\/h3>\n<p>The OAuth workflow take the following steps to grant a delegated access to an application:<\/p>\n<div style=\"clear: both; text-align: center;\"><a style=\"margin-left: 1em; margin-right: 1em;\" href=\"https:\/\/3.bp.blogspot.com\/-tFStmcvrWIU\/W8XFLz4M8qI\/AAAAAAAACbI\/-Ts9Eb76r_scDiUA0Vh5z6wNBn4kZIFdACLcBGAs\/s1600\/OAuth%2BArchitecture.jpg\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/3.bp.blogspot.com\/-tFStmcvrWIU\/W8XFLz4M8qI\/AAAAAAAACbI\/-Ts9Eb76r_scDiUA0Vh5z6wNBn4kZIFdACLcBGAs\/s640\/OAuth%2BArchitecture.jpg\" width=\"640\" height=\"334\" border=\"0\" data-original-height=\"686\" data-original-width=\"1312\" \/><\/a><\/div>\n<p>&nbsp;<\/p>\n<p><b>Step 1<\/b>: The application request for authorization for access to some resource<br \/>\n<b>Step 2<\/b>: The authorization server creates and displays a consent screen to the user<br \/>\n<b>Step 3:<\/b> If the user consents to the request, then the authorization server sends an authorisation code (authorisation grant) back to the requesting application.<br \/>\n<b>Step 4:<\/b> The application then requests for an access token from the authorisation server using the authorisation code<br \/>\n<b>Step 5:<\/b> The authorisation server identifies the application and checks if the authentication code is valid. If it&#8217;s valid, the server issues an access token to the application.<br \/>\n<b>Step 6<\/b>: The application can now access resources from using the access token<br \/>\n<b>Step 7<\/b>: If the access token is found valid, the resource server grants the resource to the application.<br \/>\nAt this point the cycle is complete. The workflow is shown in Figure 1.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t5\">5.0 Benefits of OAuth 2.0<\/h3>\n<p>It provides a stronger security and easier to implement<br \/>\nIt is an open standard<br \/>\nIt is a very robust protocol that relies on SSL (Secure Socket Layer) making data very secure<br \/>\nAllows for expiration of authentication token which make resources more secure<br \/>\nLogin credentials are not passed to the requesting application<\/p>\n<p>&nbsp;<\/p>\n<h3 id=\"t6\">6.0 What is OpenID<\/h3>\n<p>What then is OpenID?<br \/>\nNote that OAuth is a standard for authorisation. OpenID on the other hand is used for authentication to authenticate a single-sign on identity. It is created to be used for federated authentication. This means that a third party can be used to authenticate a user if the users already have some account.<br \/>\nWhile OAuth can be used for authentication too, that is not what it&#8217;s designed for. OpenID does that.<br \/>\nThere comes OpenID Connect(OIDC) which is an authentication protocol based on the OAuth 2.0 and serves an authentication layer on top of OAuth 2.0.<\/p>\n<p>I hope these brief explanation clarifies the concept.<br \/>\nYou can watch the <a href=\"https:\/\/youtu.be\/mWbfDF14LVo\" target=\"_blank\" rel=\"noopener\">video explanation here<\/a><\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My name is Kindson and in this brief, lesson I would teach you the basics of OAuth 2.0 and OpenID. You will understand what they &hellip; <\/p>\n","protected":false},"author":2,"featured_media":331,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[69],"tags":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/27"}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=27"}],"version-history":[{"count":12,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions"}],"predecessor-version":[{"id":1105,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/27\/revisions\/1105"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media\/331"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=27"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=27"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=27"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}