Authentication & Refreshing Tokens Implementation

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

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

  • @DennisIvy
    @DennisIvy  4 หลายเดือนก่อน +1

    Don't forget to check out my Complete Django course: dub.sh/rlKmDgY

    • @Rafiya.-ei5fu
      @Rafiya.-ei5fu 4 หลายเดือนก่อน

      Your Authentication tutorial is helping me complete my website. ThankYou

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

    This is very high quality content Dennis... thank you for your time and effort put into this production.

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

    This is the second time your tutorials have saved my life! I cannot thank you enough.
    YOU ARE MY HERO!

  • @theanonymous92
    @theanonymous92 6 หลายเดือนก่อน +1

    Great Video!
    Just a note for anyone watching the video,
    "If you don't get it, you probably aren't ready for it yet" because Dennis explains pretty well.

  • @jasbirsingh-mv5vh
    @jasbirsingh-mv5vh ปีที่แล้ว +2

    Came here for django authentication, along with the authentication part , this tutorial cleared my context API fundamentals too :)

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

    React-Router-dom in video is the previous version, this is for anyone using React-Router-dom v6. The must be wrapped around as shown below




    This works for v6

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

      This is true. But when I try and implement the PrivateRouter and wrap the PrivateRouter in , React breaks because PrivateRouter isn't a Route. Did you find a solution to this?

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

      @@honestoliveoil yaa i too got like that. any fix?

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

      @@munawar1288 dont forget to initialize user variable

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

      @@honestoliveoil
      # BrowserRouter

      ...

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

      sure

  • @NOTHING-en2ue
    @NOTHING-en2ue ปีที่แล้ว

    you know what there is no teacher that teaches this for free, you're the best teacher i've ever seen ❤

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

    Awesome lecture. Please watch this 2hr and it will save your whole one day in internet surfing

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

    For PRIVATE ROUTES: if you aren't redirected to login when you go to the home page from the header link, try wrapping the route tags (private and normal route) with the tag.

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

    This is exactly what I have been looking for! Complete and well explained.

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

      i think the jwt token must be decoded only in the server with a private key

  • @MuhammadAyaz-gp7xd
    @MuhammadAyaz-gp7xd 11 หลายเดือนก่อน

    Bestest Tutorial about JWT with Django on TH-cam. Thank you so much sir, for making this premium grade content for free.

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

    oh dude you saved my life too, i was looking for a tutorial about this with react and django and nothing but i found out this video and just saved my life, thank u so much!!!!!! you're a genious thaaankks!!!!! so much

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

    Amazing content, Dennis! Your channel is helping a lot with my first Django+React application. Please continue, really rich video!

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

    Very very very helpful video. Approach and explanations are great. Code is slightly outdated due to updates (router dom v6) but nothing a little research can't fix and you have updated videos on the subject too! Thank you.

  • @usamausman-dev
    @usamausman-dev 2 ปีที่แล้ว +45

    In React-Router-dom version 6 , there is bit difference.... We need to wrap the our tags inside and instead of using component attributes we need to use element as an attribute and pass the component like this .... element= {}

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

      and also useNavigate instead of userHistory

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

      Using PrivateRoute is also not displaying anything for me..

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

      @@rizwanriaz8706p plz help same problem here

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

      For me I get a problem of invalid token when a user opens his profile but sign in all is ok

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

      Knock knock ○●○

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

    Hey Dennis! Excellent tutorial, as always!
    Can you also show us how to do registration and also how a logged in authenticated user can do post requests to create/update notes?
    Cheers, bro!

  • @parthmittal5625
    @parthmittal5625 3 ปีที่แล้ว

    Thank you so much Dennis! Whenever I need anything related to Django, I just always come to your videos!!

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

    This is very high quality content. Very appriciated Thanks Dennis From INDIA, KERALA, THRISSUR, KODAKARA

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

    That's exactly what I need. Thanks

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

      Lol I was about to post that but I'm 8 months late.

  • @aryan7069_
    @aryan7069_ 3 ปีที่แล้ว

    My honest thoughts. I knew React Django but i restricted my self to build React +Django projects having authentication because i thought i can not handle authentication . And therefore build only projects with django templating language . Finally I got this playlist Thanks man

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

      same went for me in my college project. I had to use django templating since it is so hard to make user authentication in react + django

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

    I really was looking for any tutorial that explains how to apply the refreshing token, but no luck .. anyway you are a legend thanks a lot

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

    Replace components = {HomePage} to element={} do the same for login and then make you wrap the in a parent .
    Import from the 'react-router-dom'.... any confusion reply with your issue and also Note that in v6 of react Routes Redirect has been replaced with Navigate so just swap and it would work

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

    Thank you very much for the awesome content!!
    I have used React combined with firebase and Django (standalone) but never used them together. This video was really informative and helped me migrate my current frontends (Django Templates) to React.

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

    I almost never like videos, but ty bro you deserved it too much. I f*** love react + django and you just made everything for me so simple.

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

    very sophisticated course, included with beginners mistakes
    (False, so on..) however I bought all of your courses, but sometimes just funny, but big respect you are trying to show us production ready things, not just useless , common educational apps

  • @017m.shahzaibafzal4
    @017m.shahzaibafzal4 3 ปีที่แล้ว +2

    Thanks Dennis Sir. You are my Best teacher.

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

    Hi everyone! if you are having trouble with at 49:50 with Route component.... component was replaced in favor for element! I also had to wrap my Route tags in a Routes tag, so it would look more like.

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

      Thanks bro. I was looking for this. Do you know why is that?

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

      @@adnank7496 just the implementation changed with updates

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

      Thank you, it was indeed helpful

  • @mintesnottariku5309
    @mintesnottariku5309 3 ปีที่แล้ว

    What a perfect timing.. amazing .. last night I was looking for this kinda video and after 6 hours I hv seen my Django-guy made it!

  • @zhe-jiazhang9535
    @zhe-jiazhang9535 2 ปีที่แล้ว

    thank you very much. I learn JWT just in three day by your video.

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

    Thank you so much for this really, really high quality video. Very informative, explanations were on point and even the errores were interesting as it happens to everyone, even someone who knows their game like you (which makes me feel a little better :)) I finally understand the logic of JWT and can implement it in my django/angular project. My best wishes to you, and thanks again for this fine content.

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

    people suffering with changing the router version 5 to 6 for this tutorial " this guys has a video on that as well " might help"

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

    this is really useful and detailed video on authentication. It helped me a lot . Thanks Dennis.

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

    Thanks Dennis! Amazing tutorial... Congrats from Paraguay!

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

    You are the best teacher and I love watching your video.
    It will be very helpful if you make videos on vuejs.
    please 😌 ...

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

    Very Very good in-depth auth tutorial. Thank you. this is what the people need !
    Suuuuuubscribed !

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

    you saved my life of frustration thank you Dennis.

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

    Thanks for the tutorial! I never worked with tokens and auth, and was really confused about them, but after this video everything became clear.

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

      Aren't you supposed to be a Django expert?

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

      @@zenande699 lol

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

    Good job (y)
    Suggestion: You could have used setTimeout instead of setInterval so you don't have to return a clear interval method :)

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

    This was exactly what I needed. Thanks Dennis

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

    this is very valuable and thank you for explaining things thoroughly!

  • @anand_dudi
    @anand_dudi 3 ปีที่แล้ว

    Peferct time when i just finished a videos on it to implement on my project

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

    So much covered in one video, thank you !

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

    Thank yo so much. Very helpful and informative. Expecially for a beginer like me.

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

    Thank you very much for teaching this. I learned a lot from videos.

  • @tanaysheth8601
    @tanaysheth8601 3 ปีที่แล้ว

    Me:
    *Bunking scool* to attend your videos 😄😆☺

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

    Just what i was looking for + more. thanks!

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

    Thanks Denis.. You have really been helping career

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

    Thank you for the helpful video. Do you have a video for adding different role permissions for rest frame work?

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

    Thank you so much. I was really struggle for this

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

    beautiful tutorial man i love it been looking for this for while now

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

    Thank you!! It's super useful 👏🏻👏🏻👏🏻

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

    This tutorial is TOO GOOD!

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

    You are my savior! Thanks for your content

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

    i was looking for exactly this!!
    thank you so much!!

  • @김경범-i8j
    @김경범-i8j 2 ปีที่แล้ว +1

    좋은 강의 영상 감사합니다 :)

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

    The only subject missing in this tutorial is to add the old refresh tokens to the blacklistTokens when you log out

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

    make more video like this for react and backend thank you

  • @faneto9608
    @faneto9608 3 ปีที่แล้ว

    Amazing video Dennis, really enjoyed it ♥

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

    That's what I was looking for, thanks for creating this usefully tutorial you help me alot, honestly you're a life server.
    But I can't wait to see another tutorial like this by using axios

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

    27:31 google translate in chrome recognized those long JWT tokens as Polish lmao

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

    Great content, format and quality!!

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

    Thanks a lot! A very helpful video. The only remark or rather a question. Did anyone face an issue when an "Access" token disappears after multiple pages in different tabs being loaded simultaneously? E.g. one holds Ctrl and clicks on each item of the list. So the 1st and the 2nd item are loaded OK, and the rest end up with a "Login" page.
    I managed to fix it this way: in the file "AuthContext.js": let [loading, setLoading] = useState(true) _CHANGED_TO_ let [loading, setLoading] = useState(FALSE)
    and if(loading){setLoading(false)} ==> _CHANGED_TO_ if(loading){setLoading(true)}

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

    Thank You Very Much. This helps a lot!!!!

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

    HIGH QUALITY CONTENT!!! THANKS U

  • @zinness
    @zinness 8 หลายเดือนก่อน +1

    Just i want to ask Questions i didn't find another one explain django very good like Dennis i need this for my project the only thing that our project is Mobil application so the front end developed by flutter there is something changed in backend or rest the same

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

    why it is showing error when the code is exactly sale: "A is only ever to be used as the child of element, never rendered directly. Please wrap your in a ".

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

    thank you for your useful tutorials

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

    Awesome bro, respect

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

    thank you i made this with flutter and django .

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

    If anyone is having issues with Redirects and Routes not rendering check your React version.
    React-router-dom v5 will not work properly in React 18 out of the box. React 18 changes strictmode behaviour, this causes issues with stale routes.
    redirect runs, the url changes, but no components are rendered.
    You will have to, disable strictmode, switch to React 17, or update to react-router-dom@6. I just downgraded to React 17 because i don't want to deal with other future breaks, and dont need React18 added features.
    Hope this saves someone some time.

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

    Thank sir. So useful 🤟🏼

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

    Hey Dennis please add a video on social login with drf and react

  • @abhisheksanjaygawade1479
    @abhisheksanjaygawade1479 3 ปีที่แล้ว

    More video on React and Django

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

    you are the man we need !

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

    Hey Dennis,
    Thank you this is really helpful. do you have any other video for the registration and forgot password process?

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

    I wish there was an explanation on why we have to go through this insane amount of trouble doing an extra 1.5 hours of work instead of just using the “login(request,user)” method in django lol. If JWT is so much better, there has to be a better way to encapsulate all of this rather than spend an extra hour every single time we make a project that needs this complicated setup

  • @josewilhelm2717
    @josewilhelm2717 3 ปีที่แล้ว

    Just what I needed. Thanks!

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

    When creating the private route I am getting [PrivateRoute] is not a component. All component children of must be a or error. I had to wrap my routes in a Routes element because I got another error telling me to do it.

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

    Loved this Video!!
    Thank you :))

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

    Perect video. Thank you a lot

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

    Amazing work, thank you!

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

    thank uuuuuuuuu so much you saved my life

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

    Thank you!! 🙏🏻

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

    Hi Dennis bro, your doing awesome video ❤, can you please tell me what theme your using in your vs code

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

    👌

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

    i have a suggestion to add token blacklist for refresh token after logging out, it prevent older user refresh his token after log out

  • @manavlakhanpal759
    @manavlakhanpal759 3 ปีที่แล้ว

    Waiting for it 💙

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

    Hello Dennis, thank you for this video, how do I incorporate password reset, and others with simple jwt

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

    This is great. Got to know lot of things from your video. One doubt....Can we modify the default user model and create route for api to add new user ?

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

      Also looking for a way to create route to add new user, any help would be appreciated

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

    thanks for this tutorial

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

    Nice job boss!!

  • @mishagavura7859
    @mishagavura7859 3 ปีที่แล้ว

    Best of the best!

  • @sreebashkumardas8697
    @sreebashkumardas8697 3 ปีที่แล้ว

    Hey Dennis Ivy, Please make a video on multi tenant for saas based application in django.

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

    i have a question or two or three. First, storing tokens on Localstorage is considered to be very dangerous. Secondly, how about blacklisting the access token as well (maybe a manual blacklist /deny list)? The access token is still vulnerable to being stolen and used for the duration it is valid. I understand the access token has a smaller time to live but it can still be a long enough duration that ANYONE who as that access token can impersonate the user.
    Hope that you will reply to this and if found relatable for many, make a video on this.

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

      So I don't know a whole lot so take this with a grain of salt. At my current company(im an intern), we store refresh tokens in local storage. Ideally the tokens will expire soon enough to where even if the token is stolen, the intruder would only have minutes or several seconds to do whatever. So I don't believe it really metters. Could be wrong, thats what I was told. Sorry if I'm wrong

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

      @@ethangordon3935 thabks for the reply man. I guess thats how it goes normally.
      But I am willing to do a research on how big companies like Facebook and Instagram make it work. Lot to learn.

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

    YOU ARE THE BEST❤❤❤

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

    57:37 stealth flex

  • @yveskouayip1129
    @yveskouayip1129 3 ปีที่แล้ว

    very nice video, but in terms of security there is a lot to do, the backup of tokens in localstorage has many security holes

    • @yveskouayip1129
      @yveskouayip1129 3 ปีที่แล้ว

      you can be a victim of csrf vulnerabilities

    • @yveskouayip1129
      @yveskouayip1129 3 ปีที่แล้ว

      can be vulnerable to cross-site scripting (XSS) attacks. XSS

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

      Technically any POST request is vulnerable to XSS attacks, the key is to add other methods on your site to stop injections. This was a concept video, security will always be its own topic ;)

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

      @@DennisIvy Fingerprints are your best friend!

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

      how would you make this production ready?

  • @williammorris7157
    @williammorris7157 3 ปีที่แล้ว

    This is perfect, thanks!!

  • @BekzodToshpulatov-ev3jv
    @BekzodToshpulatov-ev3jv ปีที่แล้ว

    Thank you broo you helped me

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

    Thank you very much