Keycloak - A gentle introduction to Keycloak using Vite+React, NodeJS

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ต.ค. 2024

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

  • @karthik947
    @karthik947  11 หลายเดือนก่อน +5

    New video on integrating social logins is up. Link is in the description box.

  • @karthik947
    @karthik947  ปีที่แล้ว +12

    This video was taken down due to a false copyright strike and was unavailable for the past two weeks. The issue is resolved and TH-cam just restored the video. Thanks for all the support. 🙏

  • @mithogui
    @mithogui ปีที่แล้ว +11

    Quality content right here. I was struggling to find a good tutorial on this, but your approach is actually well thought out and very thorough.
    I love how you show a hands-on implementation of react using keycloak. Pretty sure no other tutorial on youtube has this so far, and I really appreciate it!

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

      Thank you for taking time to share your feedback.

  • @EklakDangaura
    @EklakDangaura 9 หลายเดือนก่อน +1

    This is great, man. Thanks for the detailed concise tutorial.

  • @miguelperezpalacios
    @miguelperezpalacios 11 หลายเดือนก่อน +1

    thank you so much for sharing this! they way you explain these concepts is so easy to follow!

    • @karthik947
      @karthik947  11 หลายเดือนก่อน

      thank you :)

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

    Quick, comprehensive and neat!

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

    Thank you for this first class tutorial. No time wasting , good organisation and explainations... Just wahoo.

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

    thanks man explained very well and do more videos on keycloak

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

    19:45 thanks that helped a lot!! I had first learnt React over two years ago and didn't know they changed the behavior of useEffect :// I was pulling my hair out over all that refreshing

  • @ammo8600
    @ammo8600 11 หลายเดือนก่อน

    Most comprehensive video on keycloak. Good work.

    • @karthik947
      @karthik947  11 หลายเดือนก่อน +1

      Thank you. New keycloak video is coming out this week on integrating social logins.

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

    Eye opener indeed....

  • @jamallmahmoudi9481
    @jamallmahmoudi9481 9 หลายเดือนก่อน

    Hi,
    great video, Thanks a lot for sharing 👌🙏

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

    Very nice and really helpful. Please make more of these

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

    i would love to see more content about keycloak, thanks for the video

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

    You are a life saver! I have struggled with the strict mode for so long I even tried removing it but this solved my issue. I'm using next.js & keycloak implemented in a java backend

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

    Best explaination on youtube, Thank you!

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

    Thank you! Very detailed explanation. I’m new to keycloak and this helped.

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

      When you covered the hook running multiple times in newer React versions, and how to solve it with ref, that was golden 👍

  • @aitt3795
    @aitt3795 17 วันที่ผ่านมา

    awesome, thanks

    • @karthik947
      @karthik947  17 วันที่ผ่านมา

      you're welcome. Thanks for leaving a comment.

  • @suryapratap3622
    @suryapratap3622 3 หลายเดือนก่อน

    you save a lot of time to setup auth thanks

  • @Ayush-jb1gr
    @Ayush-jb1gr 5 หลายเดือนก่อน

    Great one!

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

      Thank you

  • @light.yagami787
    @light.yagami787 ปีที่แล้ว +1

    This is really helpful. Thanks!

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

    Hi! Thanks for this great tutorial. You give me a good knowlage to start with

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

      Thank you for taking time to leave a comment 😄

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

    Great content

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

    Awesome guide. Thanks!

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

    Best content. From Russia with Love. It would be great with hand captioning

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

    Thanks man, this is a gem of tutorial! Please make a video on how to integrate Keycloak with Active Directory such as AzureAD

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

    Great Job Bro! I Had trouble debugging my config, because I had some whitespaces in the Web origins uri😂

  • @xmax77
    @xmax77 9 หลายเดือนก่อน

    thanks 🤝

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

    Great!

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

    you saved my life

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

    perfect 🙂

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

    Amazing,
    Please do a tutorial on Keycloak Admin Rest API
    Thank you so much for efforts.

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

    Excellent tutorial! Is there a way to further customize the login page, like custom styles etc?

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

    Excellent video.

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

      Thanks for leaving a comment.

  • @maximlopin
    @maximlopin 11 หลายเดือนก่อน

    very helpful!

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

    Good job!

  • @manee427
    @manee427 11 หลายเดือนก่อน

    Next video about roles etc .. would be greate

    • @karthik947
      @karthik947  11 หลายเดือนก่อน +1

      Thank you, Sure, I’ll make a video about roles and probably social logins as well.

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

    when are doing video for rols, group & access controls

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

    i am facing in error while configuring keycloak. For once the keycloak login is working but after login it is showing public page only and No 'Access-Control-Allow-Origin' header is present on the requested resource. this error is being displayed in console.
    ANYONE PLEASE HELP ME OUT> I M STUCK IN THIS FOR 3 DAYS

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

      even i have ensured that i wrote correct url in all 3 web origin, redirecting uri and post logout redirect

    • @ahmedtawfik4324
      @ahmedtawfik4324 11 หลายเดือนก่อน

      @karthik947 same issue here

  • @JoyKarmakar-zo7im
    @JoyKarmakar-zo7im หลายเดือนก่อน

    Really Good Video, Thank you so much (¬‿¬)

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

    Thanks, that's a great video. Could you also cover SAML?

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

    Why every time when I reload page I need to reauthenticacte, but you in video didn't have to do that?

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

    thank you for this awesome tutorial. is there any keycloak plugin for Strapi CMS?

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

    Perfect session, to the point info, Thank You so much!!!
    do you conduct keycloak trainings, I want to take a training ,please share your contact details, Thanks

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

    Great tutorial! I encountered an issue with authentication: even tho the authentication was successful, I was always redirected to the public page. I managed to solve it by putting the character '+' in the web origins, so that it uses the authorised redirect URIs as web origins! Hope this helps!

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

      @guillaume7448 ​@sadokabdelbasset3226 @vasudev1918 ​@shachimandloi8373 hope this works for you!

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

      Thanks for sharing 🙏

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

    please sir for some reason, i have followed your content till the end but my browser keeps displaying a blank page.. the public or protected text does not even sure at first ...
    i don't know how your is showing but mine is not

  • @СамадбекЮлдашев
    @СамадбекЮлдашев ปีที่แล้ว

    niceeeeeeee

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

    Hi ! thanks a lot for this video.
    I am stuck @21:30 because after logged in, I access the public page and not the protected page. F12 (in Firefox) reveals this error : "Reason: CORS header 'Access-Control-Allow-Origin' missing". After verification, my code and settings are the same as yours. Have you got an idea to fix this error ? Has it a link with Keycloak settings ?
    Could you please share your source code via a Github repo ?

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

      CORS issue occurs when your app url is not listed in the allowable origins, under realm settings.
      Sure, I'll share the code soon.

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

      hello, i also got the same problem, did you solve it ?

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

      I had the same error...have you solved it?

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

      @@karthik947 hey have you had a chance to update the code? I got the same issue... thanks for the tutorial tho!

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

      Managed to fix it - instead of putting the client URL into Web Origins just type +
      That adds all the valid redirect URIs that you defined to the Web Origins headers. As long as you have the correct Redirect URI as outlined in the video, you’ll get past it.

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

    Hi I want to have the realms dynamically from user input how to do it please help

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

    It would be very nice to cover all topics like a long video. because it is hard to find a good reference on TH-cam about this

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

      Thank you sir. I'm planning to make more extended tutorial videos like these. So stay tuned.

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

    This is a great video, thanks but, I have a problem with 37:09 . Probably the problem in authenticate.js, and this is my problem => "return done(new JsonWebTokenError('jwt malformed'));"

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

    Thanks for the video.
    Can you make a video regarding the identity providers.

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

      Thank you. Im working on a few other videos now, but I’ll add it to the list.

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

    Great content but I think that the logic you took to protect the backend route is not good because you just check if the token is provided and then decode it, this way I can use the backend route with a fake jwt and it's gonna work. Correct me if I'm wrong 😅

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

      I explained this point at @27:55. AFAIK, you cannot fake jwt. The JWT token only gets generated by the private key associated with the realm, when the login is successful. So the token itself serves as the auth validator. There is however a risk that someone can steal the token to gain access to the backend system.

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

      rest assure jwt tokens are fully secure because the client doesn't know the secret key that is used to sign tokens you can't really fake a jwt. In this case keycloak is verifying the signature, that's how it knows it hasn't been tampered with. the signature is base64 header + base64 payload, you manually change any of these and it will cause an error. If jwt's were insecure, pretty much 90% of the internet would be vulnerable lol.

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

      @@nobytes2 lol, true.

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

    Helo, please can you help make another installation video on the binance triangular arbitrage scanner

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

    Thanks for this video , its smark work :)
    i need small help , how we need validate the token , from backed .
    from the video , you did from publick key and decode the token and getting user name .
    need to know , the given token is valide for current login user .
    please support .

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

      The decode fail if the token expires. So include token validation on every authenticated backend route, and implement front end logic to logout the user when the token expires. You can also call the logout method on keycloak client, if you wish you manually logout user.

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

    hey man, really helpfull video but i have one question. From what i see you didnt surround you app with ReactKeycloakProvider, is it necessary beacuse when I try to do it it just keeps refreshinf the page infinitly

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

      You don't need to wrap your app component with ReactKeycloakProvider. Page reloading could be an issue with allow origin. Ensure your urls are whitelisted at the client level.

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

    it is working old react version.....??

  • @ИщенкоАндрей-и9й
    @ИщенкоАндрей-и9й 11 หลายเดือนก่อน

    has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. how to solve this problem?

    • @karthik947
      @karthik947  11 หลายเดือนก่อน

      Whitelist your apps url in allowable urls, in the client tab.

  • @ПавелКривальцевич-ь1р
    @ПавелКривальцевич-ь1р ปีที่แล้ว

    This video is the best. But how can we logout in react?

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

      Thank you. There is a .logout() method which you can call to trigger logout.

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

    Anyone else getting a cors error at 21:46?

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

      you need to whitelist your servers in keycloak admin panel to prevent CORS issue.

  • @v13-dd1nz
    @v13-dd1nz 11 หลายเดือนก่อน

    Hi how does one store this configuration for production?

    • @karthik947
      @karthik947  11 หลายเดือนก่อน

      I showed towards the end how you can import export configuration to a json file. That becomes your backup, which you can use to immediately restore.

  • @redpirates2664
    @redpirates2664 9 หลายเดือนก่อน

    Where do i get that url for key cloack from in env file ?

    • @karthik947
      @karthik947  9 หลายเดือนก่อน

      The url is the base url of the server where keycloak is running. If you are running on localhost on port 4000, it will be 127.0.0.1:4000/. If you are running on a server, you can replace ip and port number with the domain name. If you have nginx or some kind of load balancer, you may also specify the path (route) that fits your server side config.

    • @redpirates2664
      @redpirates2664 9 หลายเดือนก่อน

      12:43 on writing 14th line i get blank on the browser and there is a error in console saying unmatched client I'd even though I have given correct one. Please help me with this

    • @karthik947
      @karthik947  9 หลายเดือนก่อน

      @@redpirates2664 check if you specified the correct realm in environment variables. Also, console log and verify that the variables are passed correctly. They can be undefined if not passed correctly.

  • @sujan.t3241
    @sujan.t3241 ปีที่แล้ว

    Brother nenga tamil'a?

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

      No brother, I don't speak Tamil.

  • @tvpi-z1v
    @tvpi-z1v 3 หลายเดือนก่อน

    Keycloak used to be good

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

    I am using keycloak in nodeJS, 1)whichever request is below of keycloak.middlwere, whether if it is open(without --> keycloak.protect('role')) that request is requiring any token() ...and... 2) if i dont provide any token (i.e noAuth) from postman it is throwing 500 internal server crash error ( saying keyclock-token is undefined) instead of 401 unauthorised for every request(even though for keyclock.protect('role')),....why should I require token which are public to all? I am not getting ans for this on internet pls help

    • @JaneDoe-od4ep
      @JaneDoe-od4ep ปีที่แล้ว

      Is a token public?

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

      In your case, I suggest to carve out the token validation part of the code to a middleware and use it only for routes which need to be protected. That way, you don't need to pass the token for public routes.

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

      @@karthik947 Yes sir, thank you for replying I got the answer and I did the same as you suggested and it's working as per requirement now, thank you.