How to use JWT with RSA key-pair in micro-services. (JWKS.JSON)

Поділитися
Вставка
  • Опубліковано 19 лис 2024

КОМЕНТАРІ • 91

  • @KrishnaJha25
    @KrishnaJha25 3 роки тому +29

    Let's take a moment and appreciate the work you are doing. Honestly, people would charge hundreds of dollars if not thousands for these kind of videos. Very practical and to the point. Amazing explanation. I recently found your channel and believe me the content I'm finding here is exactly what I needed.
    Thanks man. Thank you so much for making such helpfull videos for us.

    • @mafiacodes
      @mafiacodes  3 роки тому +2

      I m glad that you like, comment like this motivates me in bringing more videos like this, thank you, subscribe like share 🙏

  • @be_b_50_ankitkumar_singh79
    @be_b_50_ankitkumar_singh79 3 роки тому +10

    This is the place where real software engineers come to worship :) Thanks for these videos. Practical implementation is much required, you are filling the gap very well :)

  • @vinodt.r.9124
    @vinodt.r.9124 2 роки тому +5

    I share the sentiment as many other folks who have commented here. I went through many videos to get a simple explanation to JWKS and none was as perfect and simple as your explanation. Crisp explanation. Not too fast, not too slow. Keep coming up with more videos.

    • @mafiacodes
      @mafiacodes  2 роки тому

      Thanks for that!
      Subscribe like share

  • @rajmiglani4159
    @rajmiglani4159 2 роки тому

    Sinclearly explained 👍, got here from Google news on early mornings

  • @gibraanjafar1669
    @gibraanjafar1669 3 роки тому +2

    where have you been amigo ? Have been missing these videos. Great to have you back !

    • @mafiacodes
      @mafiacodes  3 роки тому +1

      I’ll try to be regular every week

  • @kgck15
    @kgck15 3 роки тому +5

    This is excellent video. Exactly what I needed!

  • @aryanvikash1967
    @aryanvikash1967 3 роки тому +1

    Man whenever I dig your channel I found something new ❤️

  • @ajk7151
    @ajk7151 2 роки тому +1

    simply awesome tutorial. crisp & concise! was stuck because of jwks issues. thanks a lot for this. :)

  • @cuchitp
    @cuchitp 3 роки тому +1

    I have only just found out your channel, and I really enjoy them! Thank you 😊!
    I’m going to search your video library to check some more!

  • @ahmedbathily7013
    @ahmedbathily7013 3 роки тому +3

    This is another level your are very Amazing

  • @abhirupacharya010
    @abhirupacharya010 8 місяців тому

    Beautiful.
    Clear and Crisp.
    Love it

  • @basias5867
    @basias5867 Рік тому +1

    Very good content, very well explained, amazing stuff.

  • @Alex-fj2xu
    @Alex-fj2xu 3 роки тому +2

    Plain and simple! Keep going, please.

  • @subhashgn1775
    @subhashgn1775 3 роки тому +1

    Loved your explanation.
    👏👌👌
    Thank you for this great resource.
    Very grateful to you

  • @sfincione2000
    @sfincione2000 Рік тому +1

    Really good explanation and example. Nice job

  • @daidandy
    @daidandy 3 роки тому

    Welcome back buddy!!, thanks

  • @dmitrydovgopol8724
    @dmitrydovgopol8724 2 роки тому

    A huge thanks for this video! Great flow of the explanation!!!

  • @arnabsahoo2251
    @arnabsahoo2251 3 роки тому

    Welcome back, man.🎉🎉
    Make a series on microservice application design in nodejs.

  • @madhawawijekoon1204
    @madhawawijekoon1204 2 роки тому

    Superb explanation and giving really good understanding to the securing API end points in microservice architecture using JWT. very practical!, thank you.

  • @prakashapec1
    @prakashapec1 2 роки тому

    good explanation..!! you have covered a lot in this one video. Thanks for sharing your knowledge.

  • @rahulg8872
    @rahulg8872 3 роки тому

    Welcome back buddy!!

  • @zoltancaputo9562
    @zoltancaputo9562 Рік тому +1

    tks for sharing ... amazing teacher!

  • @pandulaweerasooriya7689
    @pandulaweerasooriya7689 2 роки тому

    This is simply brilliant

  • @ismailsanane268
    @ismailsanane268 2 роки тому

    Great piece of work. Just a tiny correction for 2:06 . You should say "symmetric", not "asymmetric "

  • @muratasarslan2359
    @muratasarslan2359 2 роки тому +1

    Very well, thank you for your efforts 🙂

  • @surendrareddyseelam9757
    @surendrareddyseelam9757 3 роки тому

    Master is back

  • @MajidMahdaviNasr
    @MajidMahdaviNasr 2 роки тому

    Thank you for this Great video.

  • @DigitalWinner
    @DigitalWinner Рік тому +1

    Awesome! Thanks

  • @zohaibshahzad4567
    @zohaibshahzad4567 3 роки тому +1

    You deserve love

  • @rvndnishad
    @rvndnishad 3 роки тому

    Welcome back ...

  • @warrior-kas
    @warrior-kas Рік тому

    Thanks for the great tutorial . I have one doubt. You said jwks is the representation of public key but you passed the private key to convert into Jwks

  • @PROTECHRAHUL
    @PROTECHRAHUL Рік тому +1

    Accurate ❤❤

  • @tanmaypatra9455
    @tanmaypatra9455 2 роки тому

    Informative with demo

  • @sudeepkotari
    @sudeepkotari 3 роки тому

    Waiting for your next video on node js Micro services

  • @lytuan5836
    @lytuan5836 3 роки тому +1

    I have a confuse, when you publish a jwk.json then attackers also be able to get it and use the man-in-the-middle attack method to decode, verify and change some information? can you explain it for me??? thanks advanced!

    • @mafiacodes
      @mafiacodes  3 роки тому +1

      Only public key is exposed, and in an asymmetric algorithm like RSA, public key is publishable and it is no harm because public key is meant for public, moreover one can only verify the authenticity of the token with this key, he will not be able to modify the token in any way, incase if he does modify the token would not be valid when verified with a public key.

    • @lytuan5836
      @lytuan5836 3 роки тому

      I got it, thank you so much!

  • @milon27
    @milon27 3 роки тому

    How can we use jwt for authentication for rest API mitigating XXS & CSRF attack?

  • @daoudadione7479
    @daoudadione7479 2 роки тому +1

    Thaaaank's

  • @patcodingcodester9781
    @patcodingcodester9781 3 роки тому

    Is there a reason I can't just use environment variables and a db instead of doing all of the work with pem files? My system is set up so a secret is generated for each user and that is then stored as their own secret environment variable. On requests to my auth server it uses that environment variable to set a cookie, and my authserver verifys the jwt in the cookie to the db vs a json file. But isn't it all the same thing basically? Or is doing it this way worth the change in the code. Also it's a lot of dependencies this way and that always worries me.

  • @gokul7857
    @gokul7857 2 роки тому

    Whether this flow is same as OAuth 2.0 Client Credentials Flow...Can you please check and tell?

  • @shahreazneeloy2119
    @shahreazneeloy2119 Рік тому

    Very amazing video. Please make a video on jose npm package

    • @mafiacodes
      @mafiacodes  Рік тому +1

      Bro it’s the same with more features, you can use that as well

  • @_ityadi
    @_ityadi 2 роки тому

    I just subscribed. Great video. Very well explained with proper code walkthrough. May I know which IDE you are using and which theme. The IDE color coding looks very cool.

  • @patrickconrad2874
    @patrickconrad2874 2 роки тому

    Dude this is an amazing tutorial. Thank you. Quick question for you or anyone. What's the best way to include multiple keys? I have a few different keys on my auth service, for like email verification, resets, two-point auth. Do the keys need to have a name associated with them at that point? Also is there any reason I can't store the key sets in a db? not for my own auth purposes, but I am building an oauth type system so I don't have to keep remaking the front-end logic for all the auth routes, and to offer to use it for my clients' sites as well. So what I have now is I generate keys using crypto, and then save them to an organization model. is that for any reason a security flaw? any suggestions on what I should do instead if there are security concerns.

  • @mukuljain8383
    @mukuljain8383 3 роки тому +1

    Make videos please we need you make more videos on backend and front end

  • @TechPuzzle_Haven
    @TechPuzzle_Haven 3 роки тому

    Great video.

  • @abhinavadarsh7150
    @abhinavadarsh7150 3 роки тому +1

    In a authentication system, we have two tokens - refreshToken and accessToken. accessToken is needed to be verified on every microservices so, we definetly use public and private key pair for it. But the refreshToken is used to verify only on the auth service to return a access token. So, do we use public and private key pair of the refreshToken also or stick with secrets.

    • @mafiacodes
      @mafiacodes  3 роки тому +1

      Exactly you are correct, you can easily use secrets for refresh tokens, only access tokens need pub/priv key

    • @abhinavadarsh7150
      @abhinavadarsh7150 3 роки тому

      @@mafiacodes Thanks!

    • @abhinavadarsh7150
      @abhinavadarsh7150 3 роки тому

      @@mafiacodesIf we have secret then we use env vars. But here we cannot push the cert folder to github or set them as env vars. So, how to handle deployment with public key and private key.

  • @hackingguy
    @hackingguy 3 роки тому +1

    Can u please make a series on design patterns, like DDD, TDD, SOLID etc, (Clean Code)
    It is not available on UA-cam for NodeJS, please check this out!

  • @sirnawaz
    @sirnawaz 2 роки тому

    At 19:50, you should have explained why you're using "RS265", why not "RS384"? I understand these are not related to the keys that you generated. However, the questions about the choices that you made still confusing to some of us.. as to why you did not use X and used XX instead when they look almost similar. Overall, excellent tutorial though. 😃

  • @AjayShakya-jq4wb
    @AjayShakya-jq4wb Місяць тому

    But we also send jwt secret from the auth service, so why we need this

  • @neerajverma9226
    @neerajverma9226 3 роки тому

    You should start tutorials for Spring boot

  • @riteshthakur9250
    @riteshthakur9250 3 роки тому

    And please make a video on how to deploy node microservice on aws or any other

  • @napoleonbonaparte1260
    @napoleonbonaparte1260 3 роки тому

    hello I have a question, do you recommend to create your own authentication and authorization instead of outsourcing it? or get a library instead? if not what libraries or paid services do you recommend to use in medium scale to large scale application? thank you.

    • @mafiacodes
      @mafiacodes  3 роки тому +2

      1. outsourcing? Depends on the project size, if small then definitely yes, example (firebase auth, auth0, magic links, etc, you can use any everyone has their advantages)
      2. Library? One thing more you can definitely use libraries like - passport, next-auth for next's, etc.
      3. If you have a large project, you should OWN your authentication system, otherwise you will be charged a lot in longer run, but that also means that what you are coding for authentication, and it should be rock solid, and only do that if you know what you are doing, otherwise use an authentication service as above.

  • @beratdinckan5585
    @beratdinckan5585 2 роки тому

    how can I use this method with nginx?

  •  2 роки тому

    Thanks!

  • @azharponani
    @azharponani 3 роки тому

    Hi sir,
    Can you please tell me the zsh mod you are using? Your terminal looks beautiful
    Thank you

  • @mahimahesh5616
    @mahimahesh5616 3 роки тому

    How to setup authentication for mongodb in kubernetes

  • @saimanish3385
    @saimanish3385 3 роки тому

    If both auth and resource modules are in same project, can we use directly public key to verify jwt

  • @harshaldeshpande8393
    @harshaldeshpande8393 3 роки тому

    Can we store the keys for RSA in .env files?
    Should we include or exclude .pem files while pushing to remote git repo and deployment??

    • @mafiacodes
      @mafiacodes  3 роки тому

      you can use your rsa PUBLIC (ONLY PUBLIC) wherever you want, and just keep the private key safely locked...

    • @usmansuleiman7998
      @usmansuleiman7998 2 роки тому

      @@mafiacodes where can we store it for a Docker application?

  • @fikreteliyev2266
    @fikreteliyev2266 Рік тому

    Please
    You will write this way for express rest api

  • @easwarapriyan9763
    @easwarapriyan9763 2 роки тому

    Getting undefined when passed pem files to rsaPemToJwk() function...
    Any one can help me ?
    Note:the pem files is readed properly and import also done property...

    • @glitch0753
      @glitch0753 2 роки тому

      Getting same error here! @yoursTRULY267

    • @hasanuzzamanhasan9345
      @hasanuzzamanhasan9345 9 місяців тому

      const b = Buffer.from(privateKey, "utf-8");
      let cert = b.toString();
      let certString = cert + "
      ";
      const jwk = rsaPemToJwk(certString, { use: "sig" }, "public");
      console.log(jwk);

  • @ramandahiya6977
    @ramandahiya6977 Рік тому

    ❤❤❤

  • @azzedinezouba940
    @azzedinezouba940 3 роки тому

    Hello my dear brother, can I ask for help in decrypting the data of a game I want to modify

  • @SH.K_
    @SH.K_ 2 роки тому

    🧡

  • @kifkifa56
    @kifkifa56 3 роки тому

    Where to store the token???

    • @UmaDevi-lg9bu
      @UmaDevi-lg9bu 3 роки тому +1

      use either httpsOnly cookies or authorised headers

  • @vishalshah8626
    @vishalshah8626 2 роки тому

    I echo Krishna Jha

  • @Babysharkdudu775
    @Babysharkdudu775 3 місяці тому

    Bad explanation

  • @jamshidbekabdullayev7439
    @jamshidbekabdullayev7439 3 роки тому +1

    Good night! Why such a result is returning?:
    node convertPemToJWK.js
    undefined
    Please, help me!