Skip to content

OAuth2

Posted on:September 23, 2022 at 03:22 PM

Enterprise authentication solution

SAML protocol: Single sign on(SSO) across sites.

Legacy authentication solution

Simple login: Forms and cookes.

What problem does Oauth2 address

Oauth2 flow

Oauth2 terminology

Network security terminology:

Oauth2 Flows

Oauth2 Flows

Oauth2 authorization code Flow

Oauth2 code Flow

Note

Starting the Oauth2 authorization code flow

Starting the flow

Calling back

Starting the flow

Exchange the code for access token

Exchange code for token

Access token from server

Exchange code for token

Use the access token

Exchange code for token

Identity use cases Pre 2014

Identity use cases Pre 2014

Problems with Oauth2 Authentication

What OpenID connect adds

Identity use cases today (with openID)

Identity use cases today

OpenID stack

OpenID stack

Oauth2 vs OpenID

Oauth2 with OpenID

OpenID connect authorization code flow

openID flow

Starting OIDC flow

Starting OIDC

Exchange code for access token and ID token

Starting OIDC

Auth server returns access and ID tokens

Return token and ID

ID token (aka JWT) in OpenID

The ID token

ID token in code/json

ID token in code/json

ID Token(JWT) in debugger

ID TOken(JWT) in debugger

Calling user info endpoint

Calling user info endpoint

Oauth2 Implicit flow

Oauth2 Implicit flow

Which authorization grant type (flow) to use

Authorization grant types

Server flow example

Server flow example

Mobile flow example

Mobile flow example

Authorization code with PKCE part1

Authorization code with PKCE part1

Authorization code with PKCE part2

Authorization code with PKCE part2

Implicit Flow example

Implicit Flow example

Oauth discovery

Oauth discovery

Third party(SAML) integration example

Third party integration example

Token validation

Keeping user signed in

For both local validation and introspection, the token is invalid once it expires

Note: Using okta you can spin your own authorization server in the cloud.