OAuth 2.0 & 2.1 Explained

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ต.ค. 2024
  • OAuth 2.0 and OAuth 2.1 explained. JWT in OAuth
    Patreon 🤝 / raw_coding
    Courses 📚 learning.raw-c...
    Shop 🛒 shop.raw-codin...
    Discord 💬 / discord
    Twitter 📣 / anton_t0shik
    Twitch 🎥 / raw_coding
    📃 Source Code / raw_coding
    ⏭ ASP.NET Core JWT Authentication • ASP.NET Core JWT Authe...
    📀 Authentication and Authorization Playlist • ASP.NET Core Authentic...
    ⏮ ASP.NET Core Angular Authentication • ASP.NET Core Angular A...
    🧐 oauth.net/
    #oauth #oauth2 #aspnetcore

ความคิดเห็น • 74

  • @AnsisPlepis
    @AnsisPlepis ปีที่แล้ว +5

    11:35 perfectly sums up a big part of my confusion on OAuth. awesome video

  • @pabloduarte4470
    @pabloduarte4470 2 ปีที่แล้ว +7

    Best coding channel by far.

  • @georgekopadze791
    @georgekopadze791 ปีที่แล้ว +3

    Clearly explained. Well done and of course thank you for your effort

  • @subramanyaaithal4422
    @subramanyaaithal4422 2 หลายเดือนก่อน

    You're awesome. You rap and teach so nicely.

  • @unhandledexception1948
    @unhandledexception1948 2 ปีที่แล้ว +1

    love the bit of humour dispersed throughout this complex spec
    😀

  • @LouisWaweru
    @LouisWaweru 2 ปีที่แล้ว +2

    🔥 18:47

  • @АлексейШкребнев-д4с
    @АлексейШкребнев-д4с ปีที่แล้ว +1

    Very cool videos! Thanks for the detailed explanation of all this mess, in my head.

  • @daviddevon
    @daviddevon ปีที่แล้ว +3

    With the advent of "cookiepocalypse" breaking frontend communication with AzureAD I would love to see you do a video with a SPA and API (e.g. React ASP) using Backend for Frontend pattern to mange AuthN/Z using AzureAD. I just discovered your work recently and it is such a big help. I have a lot of videos to watch :) Thanks

    • @RawCoding
      @RawCoding  ปีที่แล้ว +1

      Check my more recent videos on OAuth

    • @serg1778
      @serg1778 7 หลายเดือนก่อน

      in some of your videos i heard that OpenId gives you id and refresh in addition, which contains user data (claims).Now i'm confused a bit because here you said that access token gives access to user's data as well.Maybe I misunderstood. @@RawCoding

    • @RawCoding
      @RawCoding  7 หลายเดือนก่อน +1

      Yep access token (OAuth) gives you access to api, refresh tokens are part of OAuth still and can be used to refresh access tokens. OpenId introduces id tokens which Identify the user (aka authentication)
      Claims can go in all tokens (only in oidc, because the spec says all tokens should be jwt tokens). Oauth doesnt say that tokens need to be jwts, but rather can be any value (so more of a reference rather than a payload)

  • @stickyamp5996
    @stickyamp5996 5 หลายเดือนก่อน

    This video was really cool. Easy to follow and understood very well oauth2. Can you do the same (if not already done) with saml, openId connect and pretty much any other popular auth protocol? I'd love to watch that.

  • @cicerofoscarini8890
    @cicerofoscarini8890 2 ปีที่แล้ว

    Hey man! Nice video like always and... nice new hair :)

  • @sabashavidze4990
    @sabashavidze4990 4 หลายเดือนก่อน

    great explanation with details 🚀

  • @akamamin3197
    @akamamin3197 ปีที่แล้ว +1

    thank you for your effort.

  • @_Grunty_
    @_Grunty_ ปีที่แล้ว

    Thanks for such a didactic explanation.
    FWIW, on slide "Flow - PKCE (1)", see around 24:10, your exposition won't get any better if you fix that typo in: "[code_challange + method]". But you might want to fix it anyway 😉

  • @vvkim20
    @vvkim20 7 หลายเดือนก่อน

    the best oauth explain

  • @shreyasjejurkar1233
    @shreyasjejurkar1233 2 ปีที่แล้ว +5

    I know u already have series on auth. But would love to see how to integrate aspnetcore api with Azure app registrations things including diff scopes and things.

  • @DSD3mon
    @DSD3mon 2 ปีที่แล้ว +2

    18:56 LOL
    Very informative video, though, thanks a lot

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว +1

      Cheers, glad you enjoyed it)

  • @michaelestrinone2111
    @michaelestrinone2111 2 ปีที่แล้ว

    This video is so helpful! Thank you

  • @uRamPlus
    @uRamPlus 2 ปีที่แล้ว +1

    Oh shit u got that fresh cut? 😊😝 thanks for this lecture! liked 👍

  • @oleksandrdidenko1872
    @oleksandrdidenko1872 2 ปีที่แล้ว +13

    russians can travel only to belorussia. That was the most amazing moment in the video!!!

    • @LouisWaweru
      @LouisWaweru 2 ปีที่แล้ว

      I thought it was well done. Didn't realize others commented on it already. I should say that I enjoyed it for pointing out Western hypocrisy. I’m starting to understand people may enjoy it for different reasons though.

    • @shananboiara
      @shananboiara ปีที่แล้ว

      Ну вообще в Казахстан еще, но подъ*б засчитан)

  • @dune102
    @dune102 2 ปีที่แล้ว +3

    Great content, very detailed as I wasn't aware of the 2.1 changes.
    How does Authentication fit in with OAuth?
    Can software use OAuth like this safely for controlling access to applications/apis without first authenticating a user / user request?
    Is this where OpenId Connect comes in to sit on top / to be used in conjunction with OAuth to provide the authentication part of the puzzle?
    I guess I'm wondering how we can Authorise a request without first knowing who is making the request i.e. without the authentication part?
    edit: I'm currently thinking that we can use OAuth when we want the authorisation part irrespective of any particular user, and need authentication first when we want to allow different claims/roles/permissions depending upon a specific user.......I maybe wrong though \o/

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว +1

      Yep OpenIdConnect solves the authentication issue. Ofc you can implement so that the token would authn the user but it’s frowned upon.

    • @adamc1694
      @adamc1694 2 ปีที่แล้ว

      Things are getting really complicated these days. In the old days a company had to create and manage each user's login and password. Nowadays they can utilize a third party like Google, Facebook, MSN... to do the authentication. And then if they purchase third party software/service, a company can register the third party's endpoint URL to implement the authorization (OAuth).
      Azure has it all covered though. Pretty much just some configurations.

  • @TheAzerue
    @TheAzerue 2 ปีที่แล้ว +1

    Hi
    One question during video you mentioned that RPOC can be used if client + authorization server + resource server are one application. Please note by single application i don't necessarily mean are built in same technology say AspNetCore or Java. Fronend could be angular, react and backend could be dotnet. But all entites are under same company or team and can be trusted. But later in video you mentioned that RPOC is deprecated.
    So can we use RPOC if all three entities can be trusted or it should be avoided.
    Great video.
    Cheers

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว

      It can be used but it’s not part of the protocol. From OAuth 2.1 perspective there is no RPOC. From your perspective you’re getting a token by posting credentials to your server. Do remember it’s for authorisation if you are authenticated and you have to post credentials one more time it’s gonna feel a little weird.

    • @TheAzerue
      @TheAzerue 2 ปีที่แล้ว

      @@RawCoding Yes i understand. To authenticate again if token expires, i have used refresh token that has longer expiration

  • @DmitryKochanowski
    @DmitryKochanowski 2 ปีที่แล้ว

    Thank you. Good job.

  • @medzik1993
    @medzik1993 10 หลายเดือนก่อน

    f*cking best video on youtube !

  • @yapayzeka
    @yapayzeka ปีที่แล้ว

    31:42 I think these poor souls are SPAs with only static files. like no backend operation.

  • @shahzeb5130
    @shahzeb5130 ปีที่แล้ว

    Nice Video, Can anybody suggest the best flow for Desktop Application, based on this video i feel it is implicit flow but saving credentials in desktop application that is deployed on client machine doesn't feel to be secure.

  • @ahmedifhaam7266
    @ahmedifhaam7266 ปีที่แล้ว +1

    I'd love to know how to see this flow happen slowly in debugger, espeically since this back channel stuff can't be seen on browser

    • @RawCoding
      @RawCoding  ปีที่แล้ว

      have you seen the playlist? checkout the building your own oAuth server

    • @ahmedifhaam7266
      @ahmedifhaam7266 ปีที่แล้ว

      @@RawCoding Oh, I just saw it, thanks! Hope you know, we really, really, appreciate what you're doing.. truly, Thank you.

  • @gregorywilson2124
    @gregorywilson2124 ปีที่แล้ว +1

    What if you are doing oAuth 2 with a WPF client? Does WPF client has to do all the things that are built into the browser?

    • @RawCoding
      @RawCoding  ปีที่แล้ว +2

      WPF would have to open a browser to obtain the token. You see this when you authenticate with Visual Studio as well.

  • @erikknudsen5856
    @erikknudsen5856 2 ปีที่แล้ว +2

    Resource Owner Password Credential should be ROPC, not RPOC...?

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว

      It is, nice spot

  • @anonymousvevo8697
    @anonymousvevo8697 6 หลายเดือนก่อน

    i like the picture at the end of the wall, plus dude too many ads! come on it's exaggerating !

  • @ahmedifhaam7266
    @ahmedifhaam7266 ปีที่แล้ว +1

    I still don't really understand what the 'code' is, you said a collection of strings, ok, but what is it.

    • @RawCoding
      @RawCoding  ปีที่แล้ว +1

      It’s a random string, it’s purpose is to be exchanged for a token. The reason we give out a code instead of the token directly is because code is passed via browser url which is public and we want to keep the token secret. code is a 1 time use and is exchanged for the token via back channel.

    • @ahmedifhaam7266
      @ahmedifhaam7266 ปีที่แล้ว +2

      @@RawCoding gotchaa, thank you so much. yeaah so I work for the govenment, they are doing this unified identity system and wants to integrate that to all gov sites for citizens to login.
      I saw one string called just code, and something called a x_login_code, so was trynna understand the difference. In any case, tysm, you helped me get my middle level developer job in the gov without a degree hehe.

    • @RawCoding
      @RawCoding  ปีที่แล้ว +1

      Absolute boss well done!

  • @kenrazo2533
    @kenrazo2533 2 ปีที่แล้ว

    woohooo super great!

  • @omfgiwantausername21
    @omfgiwantausername21 2 ปีที่แล้ว +1

    What does "opt" in the diagram mean in this context? Options?

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว +2

      Nothing, the modelling tool came with it I couldn’t remove it

    • @omfgiwantausername21
      @omfgiwantausername21 2 ปีที่แล้ว +1

      @@RawCoding lol - here I was, all excited to learn a new term 🤣

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว +1

      😂

  • @shivamkumargaur9871
    @shivamkumargaur9871 2 ปีที่แล้ว +1

    I procrastinated for 6 years

  • @KunalMukherjee3701
    @KunalMukherjee3701 2 ปีที่แล้ว +1

    Now make a video on Azure ad b2c authenticating and authorizing a .net6 api

  • @oleggavrilov7083
    @oleggavrilov7083 ปีที่แล้ว

    18:57 If you in Russia, with international passport and some visas you can travel anywhere, and you don't even need a passport to travel to Ukraine for a nice vacation there.

  • @saurabhchauhan232
    @saurabhchauhan232 2 ปีที่แล้ว

    Can you Please make one video on salting and hasing password to store in db?

  • @meJevin
    @meJevin 2 ปีที่แล้ว +1

    антон... волосы куда...

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว +3

      Надоели )

    • @pavelakimov1713
      @pavelakimov1713 2 ปีที่แล้ว +2

      @@RawCoding смотрю все выпуски уже пару лет и ни разу не возникло мысли, что этот парень может говорить по-русски 😮Спасибо за видео, контент и подача как всегда на высоте!

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว

      Спасибо 😉

    • @semen083
      @semen083 2 ปีที่แล้ว +2

      @@pavelakimov1713 я спалил его, когда он в одном из видосов в качестве экземпляров класса рассматривал машины и назвал одну из них "Лада".

    • @pavelakimov1713
      @pavelakimov1713 2 ปีที่แล้ว

      @@semen083 точно точно, было такое! 😂😂😂

  • @semen083
    @semen083 2 ปีที่แล้ว +2

    Nice -haircut- video.
    1)What the point of exchage of authcode to code? Why don't instantly return token like in implicit flow? What secure advantages it provides?
    2)Client Secret it the thing, what user input in password textbox or it is single secret for client aplication(like javascript client)?
    3)What the secure place for storing acses token in Vue js application?Vuex?
    4)What the good auth flow for service-to-service communication, like between microservices?
    Thanks

    • @RawCoding
      @RawCoding  2 ปีที่แล้ว +1

      1) the token will reach the browser in the query, which can further get logged and it’s a mess.
      2) when you create a record of your app with the authorisation server it will give you a client secret to add to your app.
      3) a dedicated backend or encrypted cookie.
      4) client credentials, if it’s your services use firewall rules.

  • @CyanideM0nkey
    @CyanideM0nkey 8 หลายเดือนก่อน

    Fine, you can have a like for the Khabib reference 😜

  • @rezarezash
    @rezarezash ปีที่แล้ว +1

    Thanks for the video and content. I am trying to make a fetch request to the API endpoint and then set the response location header to the google auth server but I get the Cors Error.
    Access to fetch at 'accounts.google.com/o/oauth2/v2/auth/oauthchooseaccount?response_type=code&client_id=&redirect_uri=localhost:5279/weatherforecast&scope=openid%20profile%20email&state=CfDJ8IJqa1zOV1dOvnKTY_TMWjX1NvVUBThwVVYECnjxe4diq7xwtCmzJROXuQWLGhCMr2cSUpjVecB4Pl8LYpsF4wHZ0fu_ehXsJf9NDnDelzlN8YsEqKjUL_fVI02c-rHBD4FxM743ByQfH8uttr7kA-gbFybFfxctgjz7W_0PCVIRz9AFMUu_AQccsP1m2c0snJogwpJZcedeFKpVZjgWEfAhJethY-ouIEJZiKCF9BkZs5WeRKMjlFLVefW5RGCVk6fAgCL3BKLOWT-Qsfcjk3JU9XoFztWhI2u6XDzQL2dD&service=lso&o2v=2&flowName=GeneralOAuthFlow' (redirected from 'localhost:5279/LoginToGoogle') from origin 'localhost:5279' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

    • @RawCoding
      @RawCoding  ปีที่แล้ว

      how are you redirecting?
      you want to do window.location.href = redirect_uri