An Illustrated Guide to OAuth and OpenID Connect

OktaDev
5 Nov 201916:35

Summary

TLDRThis video script simplifies the complexities of OAuth and OpenID Connect, two crucial standards for secure data sharing between applications. It explains OAuth 2.0 as a security protocol that allows apps to access user data without passwords, using a key-based authorization process. The script then introduces OpenID Connect as an extension of OAuth, adding user authentication and identity information to the data access capabilities. Through an engaging example of a pun-sharing website, it illustrates the OAuth flow, terminology, and the benefits of using these standards for both users and developers.

Takeaways

  • πŸ” OAuth 2.0 is a security standard that allows one application to access data in another application without sharing your username and password.
  • πŸ“œ The OAuth flow includes steps for granting permission or consent, often referred to as authorization or delegated authorization.
  • πŸ‘€ The key roles in OAuth are the resource owner (you), the client (the application requesting access), the authorization server (where you have an account), and the resource server (the service you want to use).
  • πŸ”„ The authorization code flow is the most common OAuth 2.0 flow, involving a series of steps to securely exchange information between services.
  • πŸ”‘ The authorization server issues a temporary authorization code, which the client exchanges for an access token to access the resource server on your behalf.
  • 🏷️ Scopes define the specific permissions the client is requesting, such as access to data or the ability to perform certain actions.
  • πŸ”— OpenID Connect (OIDC) is a layer on top of OAuth 2.0 that adds functionality for authentication and providing profile information about the logged-in person.
  • 🎟️ With OIDC, the client receives both an access token and an ID token, with the latter containing claims about the user's identity.
  • πŸ”„ The OIDC flow is similar to OAuth, but with the use of a specific scope and the issuance of an ID token, which includes identity information.
  • 🌐 OIDC enables single sign-on (SSO) scenarios, allowing users to log in once and access multiple applications with the same credentials.

Q & A

  • What is the primary issue with sharing your username and password with other services?

    -Sharing your username and password with other services is problematic because there's no guarantee that the organization will keep your credentials safe or that their service won't access more of your personal information than necessary.

  • What is OAuth 2.0 and how does it improve upon the old method of sharing credentials?

    -OAuth 2.0 is a security standard that allows one application to access your data in another application without sharing your username and password. Instead, you give one app a key that grants specific permissions to access your data or perform actions on your behalf.

  • Can you explain the authorization code flow in OAuth 2.0?

    -The authorization code flow is a common OAuth 2.0 flow where the client redirects the user to the authorization server, which then asks for permission. If granted, the authorization server sends a temporary authorization code back to the client, which it exchanges for an access token to access the user's data.

  • What is the role of the 'resource owner' in OAuth 2.0?

    -The resource owner is the entity that owns the identity, data, and any actions that can be performed with their account. In the context of the script, the resource owner is the user who grants or denies access to their data to the client application.

  • What is the difference between an authorization server and a resource server?

    -The authorization server is the service that authenticates the resource owner and issues access tokens to the client. The resource server is the service that holds the protected resources and uses the access token to verify that the client is allowed to access the resource.

  • What is the purpose of a redirect URI in OAuth 2.0?

    -The redirect URI is the endpoint to which the authorization server redirects the resource owner back after they have granted or denied permission. This URI is provided by the client and is used to return the authorization code or access token.

  • How does OpenID Connect extend the functionality of OAuth 2.0?

    -OpenID Connect is a layer that sits on top of OAuth 2.0 and adds functionality for authentication and providing basic profile information about the person who is logged in. It allows clients to verify the identity of the resource owner and obtain information like their name and email address.

  • What is the significance of the ID token in OpenID Connect?

    -The ID token in OpenID Connect is a specially formatted string (JSON Web Token or JWT) that contains claims about the resource owner, such as their ID, name, and authentication information. It provides both authorization and identity information to the client.

  • What is the concept of Single Sign-On (SSO) and how does OpenID Connect support it?

    -Single Sign-On (SSO) is a concept where a user logs in once and gains access to multiple applications without needing to log in again. OpenID Connect supports SSO by allowing clients to establish a login session and gain information about the logged-in user across different applications.

  • How does the OAuth 2.0 flow differ from the OpenID Connect flow?

    -The OAuth 2.0 flow focuses on authorization and accessing data, while the OpenID Connect flow includes the same authorization steps but also provides an ID token with identity information. The key difference is that OIDC uses a specific scope in the initial request to indicate that it will return an ID token along with the access token.

Outlines

00:00

πŸ” Introduction to OAuth and OpenID Connect

This paragraph introduces the concepts of OAuth and OpenID Connect, explaining the challenges of understanding their terminology and the conflicting information available. The video aims to simplify these standards using clear illustrations. It starts with the historical practice of sharing information by exchanging usernames and passwords, which is now considered insecure. OAuth 2.0 is introduced as a security standard that allows one application to access data from another without sharing credentials directly. The process of granting permission is called authorization, and the video uses the example of a website called 'Terrible Pun of the Day' to illustrate how OAuth works in practice, including the steps of choosing an email provider, logging in, and granting access to contacts.

05:01

πŸ”‘ OAuth Terminology and Flow

This paragraph delves into the specific terms and components of OAuth 2.0. It defines the roles of the resource owner (the user), the client (the application requesting access), the authorization server (the service where the user has an account), and the resource server (the service providing the data or actions). It explains the concept of the redirect URI, response type, scope, and the process of client identification using client ID and client secret. The paragraph also describes the authorization code flow, which involves the client requesting access, the authorization server verifying the user, the user granting permission, and the client receiving an access token to use with the resource server.

10:02

πŸ“œ OpenID Connect Overview

This paragraph introduces OpenID Connect (OIDC) as an extension of OAuth 2.0, focusing on user authentication and providing profile information. It explains that while OAuth is about authorization and granting access, OIDC adds a layer for identifying the user. The paragraph uses the analogy of an ATM to describe how OIDC works, with the ATM being the client, the bank card as the token, and the bank infrastructure as the underlying OAuth framework. The paragraph also discusses the process of OIDC, including the use of an ID token (JWT) that contains identity information about the user, and how the client can request additional identity information using the access token.

15:04

🏁 Wrapping Up OAuth and OIDC

The final paragraph summarizes the key points about OAuth and OIDC, emphasizing their roles in secure data access and user authentication. It mentions that OIDC provides not just a key (access token) but also a badge (ID token) that contains basic user information. The paragraph encourages viewers to explore additional resources for a deeper understanding and invites feedback through likes, subscriptions, and comments. It concludes with a call to action to apply the knowledge gained from the video.

Mindmap

Keywords

πŸ’‘OAuth

OAuth is an open standard for access delegation, commonly used as a way for Internet users to grant websites or applications access to their information on other websites without giving them the passwords. In the video, OAuth 2.0 is described as a security standard that allows one application to access data from another application on behalf of the user, without requiring the user's password.

πŸ’‘OpenID Connect

OpenID Connect (OIDC) is an authentication layer that sits on top of the OAuth 2.0 protocol. It allows clients to verify the identity of the end-user based on the authentication performed by an authorization server, as well as to obtain basic profile information about the end-user in an interoperable and REST-like manner. In the context of the video, OIDC is explained as a layer that adds functionality around login and profile information on top of OAuth 2.0, providing not just access but also identity information.

πŸ’‘Resource Owner

The term 'Resource Owner' refers to the entity that can grant access to a resource. In the video, the resource owner is the user who owns the identity, data, and actions that can be performed with their account. The video uses the example of the user authorizing the 'terrible pun of the day' website to access their contacts.

πŸ’‘Client

In OAuth, the 'Client' is the application that wants to access the resource owner's data. The video explains that the client is the application that requests access to the user's data on another application, such as the 'terrible pun of the day' website wanting to access the user's contacts.

πŸ’‘Authorization Server

The 'Authorization Server' is the server that authenticates the resource owner and issues access tokens to the client after getting proper authorization. In the video, the authorization server is the service where the user logs in to grant permission to the client to access their data, such as the email service provider in the example.

πŸ’‘Resource Server

The 'Resource Server' is the server hosting the protected resources, and it is responsible for accepting and responding to protected resource requests using access tokens. The video mentions that the resource server is the application, API, or service that the client wants to use on behalf of the resource owner.

πŸ’‘Redirect URI

The 'Redirect URI' is the URI to which the authorization server redirects the resource owner when the authorization request is complete. In the video, the redirect URI is described as the URL to which the authorization server redirects the user after granting permission to the client.

πŸ’‘Scope

In OAuth, 'Scope' refers to the specific areas of access or actions that the client is requesting from the resource owner. The video explains that scopes are the granular permissions the client wants, such as access to data or to perform actions.

πŸ’‘Access Token

An 'Access Token' is a string representing an authorization credential used by the client to access the resource. The video describes the access token as a key that the client uses to communicate with the resource server on behalf of the user.

πŸ’‘ID Token

The 'ID Token' is a security token that contains a set of claims to be used in an OpenID Connect authentication flow. The video explains that the ID token is a specially formatted string (JWT) that contains identity information about the user, such as their ID and name, and is provided to the client along with the access token during the OIDC flow.

πŸ’‘Single Sign-On (SSO)

Single Sign-On (SSO) is a property of access control of multiple related, but independent software systems. With this property, a user logs in once and gains access to all systems without being required to log in again at each of them. The video touches on SSO as a scenario enabled by OpenID Connect, where a user can use one login across multiple applications, such as using a social networking service login for various websites.

Highlights

OAuth and OpenID Connect can be confusing due to their terminology and conflicting information.

In the past, sharing information between services required sharing usernames and passwords, which is insecure.

OAuth 2.0 is a security standard that allows one application to access data in another application without sharing passwords.

OAuth 2.0 uses a key for granting permissions, which can be revoked at any time.

The OAuth flow is a process of granting consent and exchanging information securely between services.

Key OAuth terminology includes resource owner, client, authorization server, and resource server.

The authorization code flow is the most common OAuth 2.0 flow and involves visible and invisible steps.

OpenID Connect is a layer on top of OAuth 2.0 that adds login and profile information functionality.

OpenID Connect enables single sign-on (SSO) across multiple applications.

An identity provider in OpenID Connect provides information about the resource owner back to the client.

The OpenID Connect flow is similar to OAuth, but it includes an ID token in addition to the access token.

The ID token is a JSON web token (JWT) that contains identity information about the user.

Claims within the ID token provide various pieces of information about the user's identity and authentication.

OpenID Connect allows clients to request additional identity information using the access token.

The video aims to simplify understanding of OAuth and OpenID Connect with illustrations and examples.

The example of 'terrible pun of the day' is used to demonstrate the OAuth and OpenID Connect flows.

The video concludes with additional resources for further learning on OAuth and OpenID Connect.

Transcripts

play00:00

hey have you ever tried to learn about

play00:02

OAuth and open ID connect but became

play00:05

overwhelmed by all the strange

play00:07

terminology and jargon there's also a

play00:10

lot of conflicting information out there

play00:11

which can be really frustrating the goal

play00:15

for this video is to explain how these

play00:17

standards work using simplified easy to

play00:20

understand illustrations and I hope we

play00:23

have a lot of fun let's get started in

play00:34

the stone-age days of the Internet

play00:36

sharing information between services was

play00:39

easy you simply gave your username and

play00:42

password for one service to another so

play00:45

they could log into your account and

play00:46

grab whatever information they wanted

play00:49

hikes you should never be required to

play00:52

share your username and password your

play00:54

credentials to another service there's

play00:58

no guarantee than our organization will

play01:00

keep your credential safe or guarantee

play01:04

their service won't access more of your

play01:06

personal information than necessary it

play01:10

might sound crazy but some applications

play01:12

still try to get away with this today we

play01:16

have agreed-upon standards to securely

play01:18

allow one service to access data from

play01:21

another the first standard we need to

play01:24

cover is oo-oo-oo auth 2.0 is a security

play01:29

standard where you give one application

play01:31

permission to access your data in

play01:33

another application instead of giving

play01:37

them your username and password you can

play01:39

essentially give one app a key that

play01:42

gives them specific permission to access

play01:45

your data or do things on your behalf in

play01:48

another application the steps to grant

play01:52

permission or consent are often referred

play01:55

to as authorization or even delegated

play01:59

authorization you authorize one

play02:02

application to access your data or use

play02:05

features in another application on your

play02:08

behalf without giving them your password

play02:12

what's more

play02:13

you can take back that key whenever you

play02:16

wish awesome as an example let's say

play02:22

you've discovered a website named

play02:24

terrible pun of the day and create an

play02:27

account to have it send an awful pun

play02:29

joke as a text message every day to your

play02:32

phone you love it so much you want to

play02:36

share this site with everyone you've

play02:38

ever met online

play02:39

who wouldn't want to read a bad pun

play02:41

every day am i right however writing an

play02:46

email to every person in your contacts

play02:48

list sounds like a lot of work and if

play02:51

you're like me you'll go to great

play02:53

lengths to avoid anything that smells

play02:56

like work so here's you everyone needs

play03:02

bad puns a good thing terrible pun of

play03:06

the day has a feature to invite your

play03:09

friends the first step is to choose your

play03:11

email provider and when you click on

play03:14

your email provider you are redirected

play03:18

to your email service your email service

play03:25

then checks to see if you are currently

play03:28

logged in if not you get a prompt to log

play03:32

in after you log in or if you already

play03:36

have an active login session you'll be

play03:38

presented with a question similar to do

play03:41

you want to give terrible pun of the day

play03:43

access to your contacts assuming you

play03:47

haven't changed your mind you click

play03:50

allow you are redirected back to the

play03:53

terrible pun of the day and the

play03:55

application can now read your contacts

play03:58

and that's the only thing it can do

play04:01

terrible pun of the day can now send

play04:03

emails to everyone you know and you'll

play04:05

be the most popular person forever

play04:08

ooofff for the win you've just stepped

play04:13

through what is commonly referred to as

play04:16

an OAuth flow the OAuth flow in this

play04:20

example is made of visible steps to

play04:23

grant consent as well as some invisible

play04:27

state

play04:27

we're the two services agree on a secure

play04:30

way of exchanging information the

play04:34

previous terrible pun of the day example

play04:37

uses the most common 2.0 flow known as

play04:41

the authorization code flow now before

play04:45

we dive into more details on what oh ah

play04:46

this' doing let's map some of the oauth

play04:50

terminologies resource owner that's you

play04:55

you are the owner of your identity your

play04:58

data and any actions that can be

play05:00

performed with your accounts the client

play05:04

is the application in our example

play05:07

terrible pun of the day that wants to

play05:10

access data or perform actions on behalf

play05:13

of you the resource owner the

play05:18

authorization server is the application

play05:20

that knows the resource owner where the

play05:24

resource owner already has an account

play05:27

the resource server is the application

play05:31

programming interface or API or service

play05:35

the client wants to use on behalf of the

play05:39

resource owner sometimes the

play05:41

authorization server and the resource

play05:44

server are the same server however there

play05:47

are cases where they will not be the

play05:50

same server or even part of the same

play05:51

organization for example the

play05:54

authorization server might be a third

play05:56

party service the resource server trusts

play06:01

the redirect URI this is the URL the

play06:06

authorization server will redirect the

play06:09

resource owner back to after granting

play06:13

permission to the client this is

play06:15

sometimes referred to as the callback

play06:18

URL response type the type of

play06:22

information the client expects to

play06:25

receive the most common response type is

play06:27

code where the client expects to receive

play06:31

an authorization code scope these are

play06:37

the granular permissions the client

play06:39

wants such as access

play06:41

to data or to perform actions consent

play06:46

the authorization server takes the

play06:49

Scopes the client is requesting and

play06:52

verifies with the resource owner whether

play06:55

or not they want to give the client

play06:57

permission client ID this ID is used to

play07:04

identify the client with the

play07:06

authorization server there's also a

play07:09

client secret this is a secret password

play07:12

that only the client and the

play07:14

authorization server know this allows

play07:17

them to securely share information

play07:19

privately behind the scenes

play07:24

authorization code this is a short-lived

play07:27

temporary code the authorization server

play07:29

sends back to the client the client then

play07:33

privately sends the authorization code

play07:35

back to the authorization server along

play07:38

with the client secret in exchange for

play07:41

an access token an access token is the

play07:45

key the client will use from that point

play07:48

forward to communicate with the resource

play07:51

server this is like a key or a key card

play07:54

that gives the client permission to

play07:56

request data or perform actions with the

play07:59

resource server on your behalf now that

play08:04

we have some of the OAuth 2.0 vocabulary

play08:07

handy let's revisit our example with a

play08:10

closer look at what's going on

play08:11

throughout the OAuth flow you the

play08:16

resource owner want to allow a terrible

play08:18

pun of the day the client to access your

play08:22

contacts so that they can send

play08:24

invitations to all your friends the

play08:27

client redirects your browser to the

play08:30

authorization server and includes with

play08:33

the request the client ID redirect URI

play08:37

response type and one or more scopes it

play08:41

needs the authorization server verifies

play08:46

who you are and if necessary prompts for

play08:50

a login the authorization server then

play08:54

presents you with a

play08:55

form based on the Scopes requested by

play08:58

the client and you have the opportunity

play09:00

to grant or deny permission the

play09:05

authorization server redirects back to

play09:07

the client using the redirect URI along

play09:11

with a temporary authorization code the

play09:16

client then contacts the authorization

play09:19

server directly it does not use the

play09:21

resource owners browser and securely

play09:25

sends its client ID client secret and

play09:28

the authorization code the authorization

play09:31

server verifies the data and responds

play09:35

with an access token the access token is

play09:39

a value the client doesn't understand as

play09:43

far as the client is concerned the

play09:45

access token is just a string of

play09:47

gibberish

play09:47

however the client can use the access

play09:50

token to send requests to the resource

play09:53

server the client is like here's an

play09:56

access token I would like the contacts

play09:59

associated with the resource owner of

play10:01

this token the resource server verifies

play10:05

the access token and if valid responds

play10:09

with the contacts requested it's also

play10:14

important to note that long before you

play10:16

gave terrible pun of the day permission

play10:18

to access your contacts the client and

play10:22

the authorization server established a

play10:24

working relationship the authorization

play10:28

server generated a client ID and client

play10:31

secret sometimes called the app ID and

play10:34

app secret and gave them to the client

play10:38

to use for all future

play10:40

exchanges as the name implies the client

play10:44

secret must be kept secret so that only

play10:47

the client and the authorization server

play10:49

know what it is this is how the

play10:52

authorization server can verify the

play10:55

client now let's talk about open ID

play11:01

Connect

play11:03

ooofff 2.0 is designed only for

play11:07

authorization

play11:08

for granting access to data and features

play11:11

from one application to another o auth

play11:14

is like giving an application the client

play11:16

a key that key is useful but it doesn't

play11:21

tell the client who you are or anything

play11:23

about you open ID Connect sometimes

play11:28

referred to as oh I DC is a thin layer

play11:32

that sits on top of OAuth 2.0 that adds

play11:37

functionality around login and profile

play11:41

information about the person who is

play11:43

logged in instead of a key o IDC is like

play11:49

giving the client application a badge

play11:51

the badge not only gives the client

play11:54

specific permissions it also provides

play11:57

some basic information about who you are

play12:01

where worth

play12:03

enables authorization from one app to

play12:06

another o IDC enables a client to

play12:10

establish a login session often referred

play12:14

to as authentication as well as to gain

play12:18

information about the person logged in

play12:20

the resource owner which is often called

play12:23

identity when an authorization server

play12:27

supports oh I DC it is sometimes called

play12:30

an identity provider since it provides

play12:34

information about the resource owner

play12:36

back to the client open ID Connect

play12:42

enables scenarios where one login can be

play12:45

used across multiple applications also

play12:49

known as single sign-on or SSO for

play12:53

example an application could support SSO

play12:56

with social networking services such as

play12:59

Facebook or Twitter so that users can

play13:02

choose to leverage a login they already

play13:05

have and are comfortable using one way

play13:09

you might think of oh I D C is kind of

play13:12

like using an ATM the ATM machine is the

play13:16

client it's job is to access data such

play13:21

as your bank balance

play13:22

and perform banking transactions such as

play13:25

withdraw money from an account or

play13:27

deposit money into an account your bank

play13:31

card is the token that's issued by the

play13:35

bank it not only gives the ATM access to

play13:38

your account the authorization it also

play13:41

has some basic information about who you

play13:44

are your identity such as your name and

play13:48

authentication information such as when

play13:51

the card expires who issued the card and

play13:54

the bank's phone number an ATM can't

play13:58

work without the underlying bank

play14:00

infrastructure similarly oh I DC sits on

play14:04

top of OAuth and cannot work without the

play14:07

underlying oo auth framework let's

play14:12

revisit our terrible pun of the day

play14:14

example the open ID connect flow looks

play14:17

the same as ooofff

play14:19

the only differences are is in the

play14:22

initial request a specific scope of open

play14:26

ID is used this lets the authorization

play14:29

server know this will be an open ID

play14:31

Connect exchange the authorization

play14:35

server goes through all the same steps

play14:37

as before and issues an authorization

play14:41

code back to the client using the

play14:43

resource owners browser the key

play14:47

difference in OID C is when the client

play14:50

exchanges the authorization code for an

play14:53

access token the client receives both an

play14:57

access token and an ID token as before

play15:01

the access token is a value the client

play15:04

doesn't understand the ID token however

play15:07

is very different the ID token is a

play15:11

specifically formatted string of

play15:13

characters known as a JSON web token or

play15:17

JWT JWT s are sometimes pronounced shots

play15:23

a JWT may look like gibberish to you and

play15:28

me but the client can extract

play15:31

information embedded in the JWT such as

play15:34

your ID

play15:35

name when you logged in the ID tokens

play15:39

expiration and it can tell if anyone has

play15:42

tried to tamper with the JWT the data

play15:47

inside the ID token are called claims

play15:50

with oh I D C there's also a standard

play15:54

way the client can request additional

play15:57

identity information from the

play15:59

authorization server such as your email

play16:02

address using the access token well

play16:09

that's it folks that is oo-oo-oo ID c in

play16:12

a nutshell if you'd like to dig deeper

play16:14

there are some additional resources

play16:16

linked in the description below I hope

play16:19

you found this video helpful please like

play16:21

subscribe and leave me comments down

play16:22

below I'd love to hear from you until

play16:25

next time get out there and be awesome

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
OAuthOpenID ConnectCybersecurityAuthenticationAuthorizationWeb SecurityOnline PrivacyTech EducationCryptographyDigital Identity