Introduction to JWT (JSON Web Token) - Securing apps & services

Поделиться
HTML-код
  • Опубликовано: 10 сен 2024
  • -What is JWT (JSON Web Token)
    -What is the structure of JWT
    -What are Header, Payload (claims) and Signature of JWT
    -How is JWT used in applications
    -How to create, tamper and verify JWT (understanding JWT, with no code)

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

  • @shaneperera6635
    @shaneperera6635 8 лет назад +3

    After hours of reading articles, this finally helped me to understand how everything fits together. Great explanation.

  • @factionzer0
    @factionzer0 5 лет назад +3

    Wow...this video was phenomenal. I was having some trouble wrapping my head around the flow of JWT's and this video cleared it up completely!

  • @motamendez
    @motamendez 8 лет назад +50

    Give a cookie to this man! Nice video I love you my men

    • @Techcbt-online
      @Techcbt-online  8 лет назад +3

      Ha ha..Thank you

    • @jasmeetsingh301
      @jasmeetsingh301 7 лет назад +12

      Cookies are what he wants us to avoid.

    • @ranjan5ua
      @ranjan5ua 7 лет назад

      Funny Jasmeete...Very funny..Excellent sense of humor.

    • @dirk1499
      @dirk1499 7 лет назад

      You saw the chance and took it :)

  • @seriousguy2007
    @seriousguy2007 5 лет назад +1

    I have never saw something explained like this! Great job sir! I am your fan already.

  • @vedangkavathiya8652
    @vedangkavathiya8652 Год назад +1

    Thank you sooooooooooooooooooooooooo much. You earned one more subscriber. You made my concept crystal clear 🙂

  • @s001dxp
    @s001dxp 7 лет назад

    Very clear and thorough explanation of the topic. Thanks for taking the time to teach this!

  • @VinodKumarBM
    @VinodKumarBM 5 лет назад

    Have seen many videos on JWT. but now I got good understanding on JWT. Thank you.

  • @adeelawan9259
    @adeelawan9259 8 лет назад

    No doubt, it is a great tutorial to learn JWT and flow of JWT based APIs. Thank you very much.

  • @hoaktechology670
    @hoaktechology670 7 лет назад

    Very nicely explained. Clear, simple understandable format. Thank you very much!

  • @onwuzorvictor3937
    @onwuzorvictor3937 6 лет назад

    Best explanation of JWT concept so far

  • @dnyaneshmisal6786
    @dnyaneshmisal6786 5 лет назад

    This video gives very clear understanding of JWT. Thank you sir for making such a wonderful video !!

  • @SushilKumarBhaskar
    @SushilKumarBhaskar 5 лет назад +2

    100000+ Incremental Likes, Excellent Explained... ee+

  • @trevorward5709
    @trevorward5709 8 лет назад +1

    Great video, very informative. Thanks very much!

  • @MovementVibes
    @MovementVibes 7 лет назад +13

    Best JWT tutorial on youtube. However I wonder how can a client verify that the data is not tampered? As client don't know the hashing key.

    • @connchri
      @connchri 7 лет назад +6

      The client doesn't use the data in the JWT - it's used server side and it's there that it needs to be checked against tampering. If you have a non-traditional web app, and have a client side app that uses JWT, then you'll need to find a secure way to share the secret so the client can verify the signature. The issue then being, if the secret becomes compromised, then you have lost all security.

    • @ericlin1824
      @ericlin1824 6 лет назад +2

      You can use a private key to sign the signature in the server side. Public key to verify the signature on the client side.

  • @samme4life
    @samme4life 4 года назад

    JWT well explained. Thank you for this video.

  • @pkjacobpullolickal7048
    @pkjacobpullolickal7048 7 лет назад +1

    Excellent tutorial. Thank You!!

  • @dravidianlabs5007
    @dravidianlabs5007 8 лет назад

    Wonderful tutorial, beautifully structured and basics are covered in detail.

  • @sajidrazarizvi9628
    @sajidrazarizvi9628 7 лет назад

    Best video on JWT, well explained !! Thank you .

  • @TellaTrix
    @TellaTrix 7 лет назад

    A way of teaching tech article JWT fabulous. The video is making sense on each sentence and properly understood. Keep updating us. i am awaiting for practical session with C#.

  • @teshomealemayehu5248
    @teshomealemayehu5248 8 лет назад

    What you are doing is really cool. Thanks

  • @srinicissp6076
    @srinicissp6076 5 лет назад

    Very well made . Crisp and sharp.

  • @amarasrilekha8091
    @amarasrilekha8091 Год назад

    very clear explanation

  • @aArcziMetin2
    @aArcziMetin2 7 лет назад

    Very very good explanation! After all those months :D I get it now! Thanks!

  • @kingramses8361
    @kingramses8361 7 лет назад +1

    Awesome tutorial. Thanks!

  • @bobbysugianto5744
    @bobbysugianto5744 5 лет назад +1

    PERFECT TUTORIAL
    Liked and subscribed!
    Keep up the good work Sir

  • @SamVsCode
    @SamVsCode 5 лет назад

    What if a hacker gets access to the token of one of my client. He can now do anything he wants on the client app till the token is expired. Now to save myself from this problem I can create and store a list of blacklisted tokens in db and invalidate them once I know there has been a malicious activity. But this method creates another problem. The biggest selling point of JWT is that its stateless so no need to make a DB call while passing JWT around, but to check the authenticity of the token, I now need to make a DB call.
    I still do not understand how jWT is better than any traditional session storage method. If I have to maintain a list of tokens on my server then how is it any different or rather how is it more useful than any other session storage authentication mechanism?

  • @CountOfPersia
    @CountOfPersia 7 лет назад

    This is the best video on the topic. Excellent work ;)

  • @wwhill8033
    @wwhill8033 6 лет назад

    Fantastic explanation, thanks very much.

  • @rajparekh08
    @rajparekh08 8 лет назад

    very well explained. Thank you for taking time out and making this video .

  • @jasmeetsingh301
    @jasmeetsingh301 7 лет назад +1

    Thanks! Very nice explanation. You saved me a lots of time.

  • @seriousguy2007
    @seriousguy2007 7 лет назад

    Wonderful! I have no sofatwre development background but you made it so easy.

  • @chaituvirtusa
    @chaituvirtusa 5 лет назад

    I have a question, how can the client verify if the jwt is tampered ( in step 4)? For verification it needs 'secret key' used by server, for generating signature.

  • @padole7385
    @padole7385 8 лет назад

    Very nicely explained !!

  • @chandra9491
    @chandra9491 4 года назад

    Does client verifies Signature? if so then client should know the password right? or Server only verifies the signature?!!

  • @codmobile9727
    @codmobile9727 8 лет назад

    Nice and simple... great work, mate...

  • @miguel.arcanjo
    @miguel.arcanjo 3 года назад

    Obrigado por compartilhar o conhecimento de forma muito didática!

  • @ravitejamadishetty3278
    @ravitejamadishetty3278 7 лет назад

    Hi,can we modify the "username" in the payload of JWT token which is coming from the sever, where I can decode the entire JWT token along with the signature again and send back to server for info of another user??

  • @timothyross4766
    @timothyross4766 7 лет назад

    Nice vid! Really makes sense.

  • @JetseDas
    @JetseDas 7 лет назад

    If you store the token in localstorage, does it imply you set a very long expiration time for the token? In the tutorial I did, they set the expiration time to three hours. How would that work in a real world scenario? You would be logged out almost every time you come back right?

  • @sanjaymahadevan4367
    @sanjaymahadevan4367 6 лет назад

    I am trying to use jwt strategy two times with different collection for user and admin ,so that route can be protected accordingly but as soon as i use it for admin ,its showing authentication error for user..and any data of user is not visible at client side...but is stored in local memory

  • @kalyanhr
    @kalyanhr 7 лет назад

    Very informative and well presented!!

  • @ZuberVhora
    @ZuberVhora 6 лет назад

    Sir I have one Question that in JWT, we have to store the encoded data in the database table also.?
    like if the username is "abc" then we have to first encode it? before storing it into the database?
    Thanks in advance.

  • @prabhu3903
    @prabhu3903 8 лет назад

    That was the best explanation in 30 mins :)

  • @vallard-
    @vallard- 8 лет назад

    at 14:50 shouldn't var jwt = s + "." + base64Encode(payload) + "." + base64Encode(signature) ?

  • @kempannamudalagi6906
    @kempannamudalagi6906 8 лет назад

    Awesome, very infromative video on JWT

  • @GauravKawatrakir
    @GauravKawatrakir 5 лет назад

    Why we use JWT means token when already we have authentication mechanism ?

  • @AlexB-tt5di
    @AlexB-tt5di 7 лет назад

    Very well explained

  • @mainulhasan35
    @mainulhasan35 6 лет назад

    Excellently explained!

  • @MadanNeelapu
    @MadanNeelapu 6 лет назад

    very nice. but very slow. but it helped me understand JWT. Thank you so much.

  • @TVP_Akshay
    @TVP_Akshay 6 лет назад

    Awesome presentation. Thankyou

  • @saifatali7885
    @saifatali7885 7 лет назад

    Thanks! You saved me a lots of time.

  • @Bibhaw
    @Bibhaw 7 лет назад

    very well explained. Thank You.

  • @dhawalbhanushali4967
    @dhawalbhanushali4967 6 лет назад

    During subsequent requests does server need to verify if its coming from the right host/client?

  • @abhishekp6080
    @abhishekp6080 5 лет назад

    At Step 4, how can a client verify the JWT token if it is tampered or not?

  • @sagarahuja5667
    @sagarahuja5667 6 лет назад

    I have stored some logged in user values in the token when the user edits it i want refresh the token is there any way ?

  • @SumanNath25
    @SumanNath25 5 лет назад

    What is the strongest and most secure web authentication that works in plain HTTP ( NOT https ) ?

  • @humble_integrity
    @humble_integrity 8 лет назад

    so what if we do want to encrypt something, what would you suggest for this? jwe?

  • @meditationmethods9421
    @meditationmethods9421 7 лет назад

    Hi,
    When the credentials are passed to the server, what 'secret' will be used by the server to create a token? Will this be shared with the client ?
    Thanks.

  • @robertkaufman1406
    @robertkaufman1406 8 лет назад +4

    Around 19:00, you say that the client can verify the token, but I don't think that is possible, since only the server will have the secret key which is necessary to do this. Am I missing something?

    • @Techcbt-online
      @Techcbt-online  8 лет назад +2

      It is possible using private key and public keys as part of implementation

    • @atif7865
      @atif7865 6 лет назад +1

      That was a fundamental part of this and you missed it! Even your reply doesnt explain it. Because of this I had to give a thumbs down because no developer will ever use JWT without understanding this part.

  • @vivekmishra5876
    @vivekmishra5876 5 лет назад

    Great tutorial

  • @MrKirankoyelada
    @MrKirankoyelada 7 лет назад

    Nice Video and Nice explain

  • @manishavyas1846
    @manishavyas1846 8 лет назад

    Thank you. Its very informative video.

  • @kssaggu77
    @kssaggu77 5 лет назад

    Thanks a lot, very informative

  • @dheerajvv1996
    @dheerajvv1996 4 года назад

    Awesome content!

  • @tazihosniomar
    @tazihosniomar 7 лет назад

    thank you sir it's really helps me a lot

  • @kaysi768
    @kaysi768 8 лет назад

    really well explained, so good thank you

  • @naumanahmed19
    @naumanahmed19 8 лет назад

    Thanks for sharing your knowledge.

  • @tysonliu2833
    @tysonliu2833 5 лет назад

    very helpful!! just one question, what if someone steels the JWT and pretends to be the issuer and everything

  • @JohnnyHorvi
    @JohnnyHorvi 8 лет назад

    good job, very well explained.

  • @tamersaleh6666
    @tamersaleh6666 8 лет назад

    The best of the best!

  • @chandan3027
    @chandan3027 6 лет назад

    Can’t we decode the signature itself? How to save signature so that it is not decode by any man in middle?

  • @ArturMusin
    @ArturMusin 5 лет назад

    Nothing but thank you !

  • @anishravindran7545
    @anishravindran7545 5 лет назад

    Excellent man.. Great video ..

  • @yassinebenhadi4883
    @yassinebenhadi4883 6 лет назад

    I appreciate this, thanks!

  • @segmentationfaulter
    @segmentationfaulter 8 лет назад

    great introduction to JWT.

  • @testinghybris237
    @testinghybris237 7 лет назад

    Nice and simple explanation. ;)

  • @andriiaveiro
    @andriiaveiro 7 лет назад +1

    how about if someone (eavesdropper) have access your token and send to server? he can access everything?

    • @gauravjlj
      @gauravjlj 5 лет назад

      I have the same question, or JWT is just for so that somebody can't temper the information?

  • @HemanthKumar-od2ej
    @HemanthKumar-od2ej 7 лет назад

    best video on JWT !!!! :)

  • @AistisJokubauskas
    @AistisJokubauskas 8 лет назад

    Great video, thanks mate!

  • @christianaguilar7107
    @christianaguilar7107 6 лет назад

    Excelent explanation.

  • @deepcoolclear
    @deepcoolclear 6 лет назад

    Excellent overview. One question is how is the secret key passed to the server in your example to verify the hash? Also will be good to mention you don’t need to do JWT level encryption yourself you can let network handle it by using TLS. Also helps against replay. If you can advise if JWT should be stored in local storage or as a cookie will be beneficial as well in terms of XSS or CSRF.

  • @deepaktibhe
    @deepaktibhe 6 лет назад

    I am facing some issues with qliksense jwt configurarion.Can anyone assist me on this?

  • @VirajGamage
    @VirajGamage 7 лет назад

    17:09 how do you secure the password when sending it to the service? Any mechanism when it comes to REST?

    • @chrach
      @chrach 4 года назад

      Regardless of REST, encrypt the client/server communication channel using https

  • @sankaranarayanan1952
    @sankaranarayanan1952 7 лет назад

    Great tutorial. one question. Anyone can take the JWT and give a request to the server with the token. Is there any server verification on the request is coming from proper client?

    • @JohanEliasson
      @JohanEliasson 7 лет назад

      I don't think there is a way to confirm that the request from a client comes from a 'proper' client. And I think that is very much what JWT is about. It is stateless.
      In what kind of usecase would this be a problem?

  • @user-qo5fm1ow9v
    @user-qo5fm1ow9v 6 лет назад

    Nice Tutorial. I have a question.
    After persisting the JWT at client side let say in browsers local storage, If any one get that token then he can access the resource by sending token in header. Is there any way we can prevent it.

    • @JPabloDonayreQuintana
      @JPabloDonayreQuintana 6 лет назад

      You can add a function like this:
      private static function Aud() {
      $aud = '';
      if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
      $aud = $_SERVER['HTTP_CLIENT_IP'];
      } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
      $aud = $_SERVER['HTTP_X_FORWARDED_FOR'];
      } else {
      $aud = $_SERVER['REMOTE_ADDR'];
      }
      $aud .= @$_SERVER['HTTP_USER_AGENT'];
      $aud .= gethostname();
      return sha1($aud);
      }
      When you generate the Token, you can add the result of this function as part of the payload.
      Then when you receive back the TOKEN and you need to check it, you can compare decoded "$aud" with current $aud
      This solution "reduce the possibility" of re-using your token if someone stole it, since it looks for your ip and browser information

  • @mukuakuizamorais6214
    @mukuakuizamorais6214 6 лет назад

    How can we protect token from being stolen? and how a server creates token for clients?

  • @na_you_mess_am
    @na_you_mess_am 7 лет назад

    What kind of information can a payload contain? I assume putting username and password would be a silly thing to do?

    • @Techcbt-online
      @Techcbt-online  7 лет назад

      password would certainly be silly...

    • @dn5426
      @dn5426 7 лет назад

      Unique id probably?

  • @stevehyuga9216
    @stevehyuga9216 7 лет назад

    It is very long, but very good tutorial.

    • @Techcbt-online
      @Techcbt-online  7 лет назад

      Thanks for the comment Brian. There have been some repetitions in the video (from the feedback received from readers). We tried to reduce repetitions drastically in recent videos. But, still unable to manage the duration of videos :(

  • @jean-marievidalenc3957
    @jean-marievidalenc3957 5 лет назад

    nice presentation, thanks

  • @davelloyd-
    @davelloyd- 7 лет назад

    First - good job explaining and I liked the demo too putting it into perspective.
    Feedback; around 12mins you say the contents cannot be modified without invalidating the token. But you don't say why until 3 mins later when you explain the signature. I think it would be more helpful to at least mention the hash is made different if you change payload during the 12 mins section.
    Now some questions;
    1) You mention the client is optional to verify the token. How can the client do this verification since it does not know the secret? This becomes obvious from the demo actually.
    2) The token can be persisted. OK, so if I am a hacker, what is to stop me simply copying the token? Let's imagine that you logged into a web page, receive the token - if hacker copies the token now, he can use the website as if he is you, correct?

  • @wylieclint
    @wylieclint 8 лет назад

    very useful.. thank you.

  • @hardikoladia7630
    @hardikoladia7630 6 лет назад

    awesome, It would be great if u create angular 2/4 tutorials and a video how to use JWT with Angular 2/4

  • @umar8539
    @umar8539 6 лет назад

    Great Explaination. I have a simple question ? what if JWT token would be stolen or hijacked ?

  • @clivesargeant394
    @clivesargeant394 7 лет назад

    great tutorial. thanks!

  • @psinghiitr
    @psinghiitr 7 лет назад

    excellent presentation.

  • @sanjibdutta9270
    @sanjibdutta9270 7 лет назад

    very nice video

  • @mnkartik
    @mnkartik 7 лет назад

    excellent explanation.

  • @ujithaperera2145
    @ujithaperera2145 8 лет назад

    thanks for your effort !

  • @djkadakamc1889
    @djkadakamc1889 7 лет назад

    Nice. Miss only the "refresh" part and considerations regarding the problems revoking token (blacklist and other strategies)

    • @jesus-love
      @jesus-love 7 лет назад +1

      well in order to revoke you must store it somewhere in the backend (redis, mongoDB, levelDB) which defeats the stateless nature of JWTs. Instead you could increase the security some other way like the module below which authenticates tokens based on IP address. Check out the link for more information.
      www.npmjs.com/package/express-jwt-ip

  • @soonclass4269
    @soonclass4269 6 лет назад

    Thank you!!!