OAuth 2 Explained In Simple Terms

Поделиться
HTML-код
  • Опубликовано: 28 июн 2023
  • Get a Free System Design PDF with 158 pages by subscribing to our weekly newsletter: bytebytego.ck.page/subscribe
    Animation tools: Adobe Illustrator and After Effects.
    Checkout our bestselling System Design Interview books:
    Volume 1: amzn.to/3Ou7gkd
    Volume 2: amzn.to/3HqGozy
    The digital version of System Design Interview books: bit.ly/3mlDSk9
    ABOUT US:
    Covering topics and trends in large-scale system design, from the authors of the best-selling System Design Interview series.

Комментарии • 143

  • @user-uk5kq3nr4r
    @user-uk5kq3nr4r 2 месяца назад +30

    I think this is the only video on RUclips, in which OAuth is explained in a very simple way.. thanks.

    • @balajik8561
      @balajik8561 2 месяца назад +1

      That's right! Excellent explanation

  • @djplt1240
    @djplt1240 11 месяцев назад +95

    Great explanation! Two minor clarifications: the authorization code is sent to printMagic service via the user with a HTTP redirect rather than the auth server directly sending the authorization code to PrintMagic. Also depending on OAuth server implementation, you may not be able to revoke the access token immediately and instead have to revoke the refresh token instead.

    • @sampathsris
      @sampathsris 11 месяцев назад +10

      This is very true, but if you try to draw arrows for all the redirects and HTTP requests, OAuth flow diagrams tend to become really convoluted.

    • @karthiksuryadevara2546
      @karthiksuryadevara2546 11 месяцев назад +5

      Whats the difference between oauth 1.0 and oauth 2.0

    • @henryzhang7873
      @henryzhang7873 11 месяцев назад +1

      There is also the server-sided flow that doesn't require a browser redirect though, where the providers can coordinate directly.

  • @nick_merchant
    @nick_merchant 8 месяцев назад +28

    Very easy to understand, clearly spoken with good graphics and solved the mystery in my mind within 4 minutes and 30 seconds. Thank you so much.

  • @tayyabmunir6228
    @tayyabmunir6228 День назад

    Wao, I was struggling with the basic concepts of oauth2 for a long time. This video explains it really well.

  • @boredhuman9289
    @boredhuman9289 6 месяцев назад +2

    Oh man, you explained this so well, I was struggling with this topic for years now, never actually understanding what is going on there! Thank you!

  • @ElvisANgoh
    @ElvisANgoh 7 месяцев назад +11

    This was incredibly refreshing and so easy to understand. This is the first video I have watched from you, I can't wait to see more, and other topics

  • @pallavkan
    @pallavkan 29 дней назад +1

    you solved my confusion in just 10 min which I was struggling after studying so many articles from medium

  • @charlymarchiaro
    @charlymarchiaro 6 месяцев назад +2

    At last!!! This is by far the best explanation I've seen. Thanks a lot.

  • @alainpannetier2543
    @alainpannetier2543 11 месяцев назад +18

    1. At 2:10 third lifeline title is wrong. Should be OAuth2 server (e.g. Snapstore OAuth2 server or 3rd party [keycloak] server) instead of "Print Magic". Cut'n paste leftover probably.
    2. At 2:49 The request dialog that submits the parroval is the one that receives the authorization code in return. So the authorization code is in the browser and acquired by print magic via the redirect_uri initially specified by PrintMagic in the request for dialog. This is why we need the authorization code indirection (otherwise either there is no client auth or the browser would know the client secret).

    • @msreedaran89
      @msreedaran89 10 месяцев назад +5

      2:21 rather than 2:10? I came to the comments to point out the same thing

  • @ayoolaoladipe8105
    @ayoolaoladipe8105 Месяц назад

    The explanation is straight to the point and the graphics makes it easier to understand
    thank you

  • @SoupTubeTV
    @SoupTubeTV 5 месяцев назад

    This channel is invaluable. Thank you for your knowledge!

  • @jamaicanstillbapin
    @jamaicanstillbapin 4 дня назад

    Excellent video, many thanks!

  • @sheykenasababy
    @sheykenasababy 9 месяцев назад +1

    0:40 "To scrape information from crusty old banks" I did not expect a roast this hard

  • @videogamesare1
    @videogamesare1 Месяц назад

    Outstanding video! Thank you!

  • @hakkoktay7597
    @hakkoktay7597 5 дней назад

    Explained in a very simple way but also excellent!

  • @sungjuyea4627
    @sungjuyea4627 11 месяцев назад +9

    I always get irritated by this complex and "seemingly" pointless process. Now it is very clear why we need it. Thanks to your explanation :)

  • @vintagewander
    @vintagewander 11 месяцев назад +2

    I was about to implement google login from scratch and had a lot of problems implementing it without relying on external libraries. This video helped me a lot sir, thank you for your content ❤

  • @madhavareddy580
    @madhavareddy580 12 дней назад

    Beautiful visuals and amazing explanation.
    Thanks!

  • @sumanthvarma9999
    @sumanthvarma9999 11 месяцев назад +12

    Can you cover Kerberos authentication please

  • @ayaabdelmagied6696
    @ayaabdelmagied6696 8 месяцев назад

    you head nail on the head.... simple and to the point

  • @saravanansomu8296
    @saravanansomu8296 4 месяца назад

    Very nice explanation with the perfect animation. It's slick because it doesn't need lot of implementation details here.

  • @meghnamanjunatha4707
    @meghnamanjunatha4707 8 месяцев назад

    Thank you so much for the clear and simple explanation!

  • @padalaraveendra
    @padalaraveendra 10 месяцев назад

    Breakdown of complex concepts in to digestable explanations --> Quite Appropriate wording😍

  • @wirelessnerd7131
    @wirelessnerd7131 4 месяца назад

    Thank you for the explanation. Simple and straight forward and btw great graphics.

  • @edydon
    @edydon 9 месяцев назад

    Very clear presentation. Keep up the great work!

  • @fong555
    @fong555 10 месяцев назад +1

    Another great video! Thank you for your time and effort! Could you please share or make a video about what tool and how you made those animated diagrams? Appreciated so much!

  • @jubiaj2672
    @jubiaj2672 6 месяцев назад

    best explanation so far. thank you

  • @AkshayHendre2010
    @AkshayHendre2010 11 месяцев назад

    Thanks for the video! Finally I know what this OAuth 2 is.

  • @locotx215
    @locotx215 8 месяцев назад +1

    You did it, you finally explained the WHY part . . . ."so you don't have to share credentials with other sties"

  • @sridharneelakanta
    @sridharneelakanta 7 месяцев назад +6

    Thanks for the concise explanation. Appreciate it. A small correction -- the sequence diagram at 03:52 shows "PrintMagic" within the blue rectangle. It should have been "Snap Store Auth". Thanks again.

    • @devrj1679
      @devrj1679 22 дня назад

      Yes your correct, but green rectangle. Thanks for pointing that out.

  • @basseygodwin7384
    @basseygodwin7384 7 месяцев назад

    Clearest video I've seen on this

  • @etshbadr
    @etshbadr 8 месяцев назад

    Love your explanation!

  • @hasan_shans
    @hasan_shans Месяц назад

    Great explanation! Thanks!

  • @muhammadumarsotvoldiev8768
    @muhammadumarsotvoldiev8768 4 месяца назад

    Thank you very much! Very helpful!

  • @gsenthilkumar8139
    @gsenthilkumar8139 2 месяца назад

    00:04 OAuth 2 simplifies secure access to resources.
    00:37 OAuth 2 is like giving someone a special key for accessing specific information in another application.
    01:12 Using OAuth2 to grant permission to access Snap Store photos.
    01:39 OAuth 2 facilitates secure access to resources
    02:16 OAuth2 process flow explained
    02:50 Authorization code is exchanged for access token by the client.
    03:24 OAuth 2 protects login credentials and allows controlled access to authorized resources.
    03:58 OAuth 2 is essential for web security
    Crafted by Merlin AI.

  • @canhlinh
    @canhlinh 2 месяца назад

    Nice presentation. Thank you.

  • @tahiraziz193
    @tahiraziz193 10 месяцев назад

    Your explanation is Aws0me👍

  • @ml-rj5pt
    @ml-rj5pt 7 месяцев назад +1

    Thanks for the great video. One question though...at 3:20 when PrintMagic fetches photos with the access token, does the SnapStore Resource still need to validate the access token? If so, does it need to call SnapStore Auth api to validate?

  • @jaiyden9888
    @jaiyden9888 9 месяцев назад

    Thanks for this! Great video :)

  • @user-rd4oo1jg5g
    @user-rd4oo1jg5g 8 месяцев назад

    Very good video, I have a question if I am developing an app, my server would do authentication service based on what I implement and authorization server, right? In the latter I should implement the access by roles, within the same token as information I would get the scope to compare whether or not you have access to the resource?
    Thank you very much

  • @jlp2011
    @jlp2011 8 месяцев назад +2

    great vid. minor remark : 1st collab/msg diagram - full one - puts printmagic on 2nd n 3rd lane from left. 2nd diagram has 3rd lane being snap’s auth which makes more sense

    • @am_0x2a
      @am_0x2a 6 месяцев назад

      I noticed this too. Great video overall though!

  • @vicenterendo
    @vicenterendo 4 месяца назад

    Thank you so much, lifesaver!

  • @himanshujain5670
    @himanshujain5670 9 месяцев назад

    simple and crisp explanation

  • @mahamadoutogola4001
    @mahamadoutogola4001 5 месяцев назад

    Great explanation 😊

  • @somnathgolui2912
    @somnathgolui2912 11 месяцев назад +1

    Thanks for the video.

  • @7tsh
    @7tsh 9 месяцев назад

    The video looks great. would you mind telling me which tool does you use to create the video ?

  • @user-td1nr8hc7x
    @user-td1nr8hc7x 9 месяцев назад

    Great Explanation👏. One question what happens if refresh token expires, will the user have to go through oauth process again.I'm just curious.

  • @musaddiqueansari7695
    @musaddiqueansari7695 4 месяца назад

    wow! great explanation

  • @haykkarapetyan867
    @haykkarapetyan867 Месяц назад

    Great explanation, BUT on 3:51 the "Snap Store Auth" changes into "PrintMagic" on your sequence diagram. This makes it look like the refresh token is given to the same "PrintMagic" to get updated Access Token

  • @cuybueno
    @cuybueno 6 месяцев назад

    Another kickass video!

  • @willpringle
    @willpringle 9 месяцев назад

    Awesome video!

  • @axis0401
    @axis0401 6 месяцев назад

    Animation in this video is awesome

  • @trickytricktwo
    @trickytricktwo 3 месяца назад

    very nice explanation

  • @zehrairkicatal2156
    @zehrairkicatal2156 3 месяца назад

    excellent explanation

  • @bhaveshmuleva2352
    @bhaveshmuleva2352 6 месяцев назад

    Will implement in my upcoming project

  • @XJacksonvilleX
    @XJacksonvilleX 6 дней назад

    the graphics are amazing.. how do you create them??

  • @sLiv256
    @sLiv256 10 месяцев назад

    perfectly explained

  • @BehniaFB
    @BehniaFB 5 месяцев назад

    I liked the animations

  • @ronitdhingra4395
    @ronitdhingra4395 11 месяцев назад +7

    What tool do you use for the animations? they are great!!

    • @laserz23
      @laserz23 9 месяцев назад

      curious to know this too

  • @robot67799
    @robot67799 10 месяцев назад

    Awesome!

  • @systemBuilder
    @systemBuilder 29 дней назад

    It would be super awesome to give an example of a barebones OAuth2 that everybody uses (like a draw webapp asking for access to your google drive with frw other assets) then we could literally watch the OAuth2 in the Chome debug window under the network tab.

  • @oskarspozdnakovs6441
    @oskarspozdnakovs6441 10 месяцев назад

    Great video. It's Zero Auth by the way

  • @foadkh8210
    @foadkh8210 6 месяцев назад

    Thanks !!

  • @user-rd4oo1jg5g
    @user-rd4oo1jg5g 9 месяцев назад

    Hello, how are you, there are applications that request a token, request that the client id and seceret key be sent, others an api token and a secret key, how is this different from, for example, sending user and pass?

  • @vatsalshah8680
    @vatsalshah8680 10 месяцев назад

    Question - How does the SnapStore resource server verify the OAuth token? Does it call the OAuth service to do this?

  • @juozasjuozas
    @juozasjuozas 3 месяца назад

    That was great! But how about registering? Eg. using a google Account to log in.
    Considering i can revoke the token. How can I log in despite never having given my password to the external side?

  • @codewriter3000
    @codewriter3000 8 месяцев назад

    What do you use for animations?

  • @sergiomora1209
    @sergiomora1209 27 дней назад

    Can Google App Passwords still be used to access Gmail through Outlook 2019 using POP3 after LSA’s is disabled?

  • @yashwanthbedre8220
    @yashwanthbedre8220 11 месяцев назад +1

    simplest explanation ever!

  • @mightylb4543
    @mightylb4543 11 месяцев назад +5

    Why we need 2 different codes ? Authorization codes and access tokens, why was it designed this way?

    • @avidtechie9734
      @avidtechie9734 11 месяцев назад +4

      an authorization code is a temporary credential that serves as proof of the user's consent to access their protected resources. It plays a crucial role in the OAuth flow and is used to obtain an access token, which is then used to make authenticated API requests on behalf of the user.
      The authorization code flow adds an extra layer of security to the OAuth process. Instead of directly exchanging user credentials (e.g., username and password) for an access token, the authorization code flow separates the authorization and token exchange steps. This way, the access token is not exposed to the client application, reducing the risk of unauthorized access or token leakage.
      OAuth: Authorization Code Importance
      In OAuth, an authorization code is a temporary credential that serves as proof of the user's consent to access their protected resources. It plays a crucial role in the OAuth flow and is used to obtain an access token, which is then used to make authenticated API requests on behalf of the user.
      Here's an overview of why an authorization code is needed in OAuth:
      User Consent: OAuth is designed to protect user data and privacy. Before an application can access a user's protected resources (such as their profile or data), the user must explicitly grant consent. The authorization code serves as evidence that the user has granted permission for the application to access their resources.
      Security: The authorization code flow adds an extra layer of security to the OAuth process. Instead of directly exchanging user credentials (e.g., username and password) for an access token, the authorization code flow separates the authorization and token exchange steps. This way, the access token is not exposed to the client application, reducing the risk of unauthorized access or token leakage.
      Limited Lifetime: Authorization codes have a limited lifetime, typically short-lived, making them less susceptible to misuse. Once an authorization code is issued, it has a short validity period, usually a few minutes. This helps mitigate security risks and reduces the window of opportunity for attackers to intercept and abuse the code.
      Authorization Code Exchange: After obtaining the authorization code, the client application sends it to the authorization server, along with its client credentials, to exchange it for an access token. This token can then be used to make authenticated API requests on behalf of the user.
      By using an authorization code, OAuth ensures that the user's consent is obtained, enhances security by separating authorization and token exchange steps, and provides a limited and controlled means of obtaining access tokens.
      In Authorisation code flow this happens. There are various authentication / authorisation flow available.
      In the above video authorisation code flow is explained.
      In which authorisation code is returned after successful authentication. Then authorisation code + client id + secret key is sent to the server which validates that the user is the same as authorization key is the same and it is not tempered. And then the server returns 3 tokens. (1.Access tokens which contain scopes/ permission used for sending requests to get resources. 2.Id token which contain user information/ claims. 3. Refresh token - this is optional.)

    • @azvyae
      @azvyae 11 месяцев назад

      ​@@avidtechie9734from my perspective as user who will access the resource, the auth code simply like 2FA codes eh? Given from the auth server to the user, then user itself "approve" the permission that the resource should be consumed by the client app right? So then after the user "give the code" to the client app, the client app then can have the access token. Am I right? Or i'm missing something?

    • @tsunghan_yu
      @tsunghan_yu 11 месяцев назад

      Mainly two security benefits:
      1. we can avoid sending the access token, which is sensitive information, in the front channel and send it in the back channel instead.
      2. we can authenticate the client as well by requiring the client to send client_id and client_secret (along with authorization code) to request the access token.
      Here's a video that directly answers your question:
      ruclips.net/video/996OiexHze0/видео.html
      And here's a good illustration of the whole flow:
      ruclips.net/video/PfvSD6MmEmQ/видео.html

    • @henryzhang7873
      @henryzhang7873 11 месяцев назад

      This prevents the client from knowing the token. The services may not trust the client or want to charge money for operations without the risk of spoofing.

  • @brianliang3010
    @brianliang3010 10 месяцев назад +1

    why can't access token be sent along in permission granted response and requires another request?

  • @twinkleverma2945
    @twinkleverma2945 6 месяцев назад

    Hi @ByteByteGo ... @3.51 the 3rd tower's name is incorrect. It should be "SnapStore Auth" instead of "PrintMagic". It becomes confusing at this point.

  • @michelledigdecarvalhoperei144
    @michelledigdecarvalhoperei144 9 месяцев назад

    caralho mt bom explicou o que to tentando entender faz 1hora pesquisando na net
    valeu

  • @annetak693
    @annetak693 4 месяца назад

    Not sure I heard it right at 2:55. So, #authorizationcode IS #clientId and #clientsecret?? Or #authorizationcode WITH #clientId and #clientsecret (and are presented to authorization server?)

  • @davideanguianomelendez628
    @davideanguianomelendez628 Месяц назад

    It seems to me that diagrams on 2:20 and on 3:58 have a mistake: the green "PrintMagic" actor should be labeled as "SnapStore Auth", as it actually is on 3:17. Am I right?

  • @tadtab2
    @tadtab2 9 дней назад

    @2:20 the 3rd column need to be renamed 'SnapStore ' instead of 'PrintMagic'?

  • @Shitbull4Azlakssss
    @Shitbull4Azlakssss 8 месяцев назад

    what a good video

  • @deemon710
    @deemon710 3 месяца назад

    @3:22 That feels a tad redundant. Anyone know why SnapStore Auth doesn't immediately give the access token (in green) after the request is approved (in blue)? Why is the "Get Access Token" (in yellow) step needed?

  • @ikbo
    @ikbo 8 месяцев назад +1

    Why the extra http request of getting authorization code then access token?

  • @uttambasak100
    @uttambasak100 9 месяцев назад

    3:53 both the heading is written as PrintMagic is that correct

  • @user-ol8uu1kh6o
    @user-ol8uu1kh6o 4 месяца назад

    when oAuth is enabled, the client software first requests for authorisation from the auth server & auth server asks the user for approval and when approved, auth server gives an access token to the client software and client can make requests and get responses

  • @nitinkumar28
    @nitinkumar28 10 месяцев назад

    How SnapStore Auth server authenticate [#authorizationcode #clientid #clientsecret] ? Are #clientid #clientsecret and scope are provided to PrintMagic by User and stored at SnapStore Auth server as well ?

  • @JinTsen
    @JinTsen 5 месяцев назад

    There is a small mistake. When you first animate the flow at 2:19 , you have 2x PrintMagic, missing the (later fixed) SnapStore Auth

  • @ngamlenmangtouthang4507
    @ngamlenmangtouthang4507 8 месяцев назад

    please make a video on access token and refresh token :)

  • @pwn2424
    @pwn2424 11 месяцев назад

    what is a permission dialogue?

  • @800pieds
    @800pieds 25 дней назад

    Clear, but how does Snapstore know that the token is valid?

  • @StanleySathler
    @StanleySathler 5 месяцев назад

    Why after receiving the authorization code, we still need to request the access token? Couldn't we just retrieve the access token directly?

    • @StanleySathler
      @StanleySathler 5 месяцев назад

      After a long convo with ChatGPT, that's what I came with:
      There's always some UI involved, as the user needs to consent permissions. As UI's are less secure environments, it'd be risky to give them the access token. That's why we often do the "authorization code access token" exchange in a server environment.
      Still, would love extra thoughts on this.

  • @royd-w
    @royd-w 9 месяцев назад

    Out of curiosity, why can't the snapstore auth immediately give printmagic an access token once resource permission has been granted? What is the purpose of the "get access token" step?

    • @runilmotwani9549
      @runilmotwani9549 9 месяцев назад +1

      Printmagic has to use its own client ID and secret to authenticate itself to snapstore before it gets the real access token. It's an additional layer of security

    • @royd-w
      @royd-w 9 месяцев назад

      @@runilmotwani9549 Thank you

  • @ryankan1
    @ryankan1 11 месяцев назад

    does anyone know the app used to make these animated process flow diagrams?

    • @YuruCampSupermacy
      @YuruCampSupermacy 11 месяцев назад +1

      Most probably Adobe after effects

    • @tsunghan_yu
      @tsunghan_yu 11 месяцев назад +1

      it's in the video descriptions

  • @sampathsris
    @sampathsris 11 месяцев назад +4

    What if we used OAuth2 in our web apps as a way to authenticate with a Resource Server? Because, the authentication with the resource server is implicit in this flow, isn't it? /s
    Nice video. Would love to see an OpenID Connect video as well. :)

    • @snk-js
      @snk-js 11 месяцев назад +1

      that's the whole point u need a server to manage access keys

    • @marcelocardoso1979
      @marcelocardoso1979 11 месяцев назад +3

      This is actually called federated login. You have a single point of authentication that is trusted and well secured to access all your resources. It wouldn't make much sense to implement an authentication/authorization server into every app, otherwise we would need to trust all apps and single sign-on flows wouldn't be possible anymore. This kind of authentication/authorization also allows zero-trust networks to exist.

  • @user-pm3wp2sd3u
    @user-pm3wp2sd3u 11 месяцев назад +1

    how to make a video like this

  • @rustamergashev7278
    @rustamergashev7278 5 дней назад

    👍

  • @yashsolanki069
    @yashsolanki069 17 дней назад

    I would like to know if this (OAuth 2.0)service is free to use or has some charges after some requests.
    If anyone has any idea, please let me know.

  • @abdoyones1983
    @abdoyones1983 3 месяца назад

    is there a mistake in the diagram @ 2:19 ?

  • @jasoncampbell1464
    @jasoncampbell1464 3 месяца назад

    In a nutshell, you ask app 1 to invoke app 2. App 2 comes to you and asks if the request is legit. If you say yes, the apps create a secure communication channel and start collaborating to offer you the service

  • @lukevandam7610
    @lukevandam7610 9 месяцев назад

    How would one go about making animations like this?
    I don't even know how you would get that little window that shows you in it in the video :(

  • @autumnfjeld4766
    @autumnfjeld4766 11 месяцев назад +1

    Who is "us" and "we"? Are you speaking about the end user when you say "us" and "we"?

    • @StockDC2
      @StockDC2 11 месяцев назад

      Yes, the end user (i.e client).

  • @dibbyo456
    @dibbyo456 11 месяцев назад +1

    Fatastic visualisation

  • @patrykforyszewski4655
    @patrykforyszewski4655 2 месяца назад

    Isn't there a mistake on diagram at ruclips.net/video/ZV5yTm4pT8g/видео.html with doubled Print Magic on top?

  • @bluehornet6752
    @bluehornet6752 12 дней назад

    Great video, but you seem to have a couple of errors in your graphics, at 2:19 and 3:51 in the timeline. Your third header there should not be "PrintMagic" but rather "SnapStore Auth," like you have at 2:23 in the timeline. If this is *not* a mistake, then it's confusing at those first two points in the timeline...because it seems to make perfect sense with the version of the graphics at between 2:23 and 3:24 in the video.
    The way you show the summary at 2:21, why would we ever want PrintMagic to be able to generate its own request from the user for access to the resource server? That doesn't make sense to me--so it seems to me anyway, that what you have (and describe) from 2:23 - 3:24 in the video is accurate, correct and (dare I say) understandable. The graphics on either side of that (ie; at 2:19 and 3:51) don't make sense.