man you are the best, straight to the point, no copy pasting, and very easy and readable code and step by step process, something that lots of tutorials struggle with, thank you so much.
Watching this today, although this is 3 years ago and there is an optimized way to use JWT, this really helped me understand what happens during a JWT authentication. Kudos
I think this cannot be used on a app. Right? Mobile app cannot access cookies. I am developing in flutter. Does the method shows in this video can be done using cookies?
very well explained....loved this. Yeah, some exceptions are that, the person has to make a create_superuser function to create a superuser but its fine. JWT explained wonderfully
Thanks a lot man, I had a hard time until I saw this one. The explanations were on point as well, cors even fixed a front-end problem my team had. Hope you grow big!
Man you don't know how much I appreciate this video, let me tell you I've been looking for something like this for weeks, let me tell you there's nothing.
In May 2023, I had to change this: payload = jwt.decode(token, key='secret', algorithm=["HS256"]) to this: payload = jwt.decode(token, key='secret', algorithms=["HS256"])
Great tutorial my brother! The cookies aren't saving automatically when I use ReactJs - Axios. How can I save the cookies automatically and also send it as part of the request using Axios or Fetch API
Hi, great video! One question: At @26:12, why did you decode the token? I get the error "'str' object has no attribute 'decode'" If I drop the decoded I get a decoded string.
Awesome tutorial dude! One question: at 21:08 when you are fetching the user from the db, why do you do a filter and then a first instead of simply a get()? Thanks!
filter(), whenever you expect more than just one object that matches your criteria. If no item was found matching your criteria, filter() returns am empty queryset without throwing an error. get(), you expect one (and only one) item that matches your criteria. Thus if there are more than one objects returned in queryset we would know that via filter
The cookies aren't saving automatically when I use ReactJs - Axios. How can I save the cookies automatically and also send it as part of the request using Axios or Fetch API
thanks for high quality video, but i have a question for you~~ in the Userview part,, why you attech code -> ".first()" ?? when I want all of the logined people, how can i???
Because filter() returns a List and I add .first() to retrieve a single object. To get all the logged in users you have to store the jwt with the user_id in a database
Hey, I did this auth and now connecting it to Vue js frontend but when I sign out, I am still able to access protected views that need authentications. Only when I clear the browser cookie do the access stop. Also the cookie is still within the header when I sign out. How can I fix this? it work fine in postman.
Thanks but please do `NextAuth` with Django Rest Framework, with email and password. Also, adding OAuth on the same tutorial will be great. I am desperetely waiting for your response.
man you are the best, straight to the point, no copy pasting, and very easy and readable code and step by step process, something that lots of tutorials struggle with, thank you so much.
Is loggingView working for you?
Watching this today, although this is 3 years ago and there is an optimized way to use JWT, this really helped me understand what happens during a JWT authentication. Kudos
share link for the optimized way
I think this cannot be used on a app. Right? Mobile app cannot access cookies. I am developing in flutter. Does the method shows in this video can be done using cookies?
Truly the smoothest and most accurate Django-JWT Tutorial I've ever seen!!!
This was the best video I've watched on TH-cam about Authentication using JWT Tokens. Thank you so much!
The best token based Authentication I have watched. Very detailed. Thank you
Perfect Tutorial for basic auth so far. Loved it! Keep it up Sir! 💖
very well explained....loved this. Yeah, some exceptions are that, the person has to make a create_superuser function to create a superuser but its fine. JWT explained wonderfully
in serializer?
Thanks a lot man, I had a hard time until I saw this one. The explanations were on point as well, cors even fixed a front-end problem my team had. Hope you grow big!
Glad it helped!
@@ScalableScripts I am getting error while decoding the token in userview
@@nepdevtech me too... For me it says.
"
'str' object has no attribute 'decode'
"
Have u got the solution??
@@ScalableScripts why I am getting - RecursionError: maximum recursion depth exceeded while calling a python object. How to solve...
@@goodboy435 decode is not needed since its already decoded remove the decode and it will work
This is the best video on JWT and tokens in django and django-rest-framework ... thank you million times sir ❤❤
Thanks! I had hard times trying to discover how to use jwt and you solved all questions that i had.
Best video for drf authentication. Totally loved it and learned a lot.
26:10
dont need to .decode("utf-8")
just
token = jwt.encode(payload, 'secret', algorithm='HS256')
that's it
Man you don't know how much I appreciate this video, let me tell you I've been looking for something like this for weeks, let me tell you there's nothing.
plz tell me if you know how i applied Bearer method in video video instead of cookies.
Awesome! thanks for your explanation. I just want to remind these typical topics for django, it always important to continue improving our skills.
thank you so much for the video, because of this now i and my group can sleep in peace hahahaha
This is an amazing video. So clear. Answered most of my questions before I asked them.
Very good video! Without getting lost in the bush, getting to the concept clearly
Greetings from Argentina!
In May 2023, I had to change this:
payload = jwt.decode(token, key='secret', algorithm=["HS256"])
to this:
payload = jwt.decode(token, key='secret', algorithms=["HS256"])
Thanks for this. You just helped me.
Thanks for the clear explanation. Bdw, what about the refresh token.. don't we need that as well ??
I dont usually comment on yt videos, but this video is so damn good, with your explanations and the way how you talk.
Keep up brother
Thank You! You have explained it so clearly, I haven't been able to understand this since days but with this one I was able to easily
Great tutorial my brother!
The cookies aren't saving automatically when I use ReactJs - Axios.
How can I save the cookies automatically and also send it as part of the request using Axios or Fetch API
Can you tell how can i send token from frontend to backend again for each request as i am storing it as cookie on frontend ?
super straightforward and concise, great job!
Video Explanation is Really amazingly. But Why there is no refresh token??
The best explainantion and ONPOINT, loved it, Thank you 🙏
Excellent work. Thank you
very helpful video and keeping it simple tthanks!
This is tutorials is awesome.. Thanks a lot
that was really helpful, and very straightforward! Thank you so much.
Hi, great video! One question: At @26:12, why did you decode the token? I get the error "'str' object has no attribute 'decode'" If I drop the decoded I get a decoded string.
Hi, You can downgrade the PyJWT package to 1.7.1 or remove the call to decode. It should work
@@matteob9342 removed .decode() and it dit work fine afterwards. Thanks!
Got same error.. Just after an year.
@@matteob9342 thanks matteo... Ur removing decode() call method worked for me too...
@@goodboy435 how can i do it ?
Thanks a lot good man!
God always bless you!
Many Many Thanks For you good man!
thank you very much. excellent presentation of the material
I learnt a lot here Thank You !!!
How can I create super users?
best teacher ever
What about CSRF policies and securities, Why are they not applied here?
Great content, subscribed !
Awesome tutorial dude! One question: at 21:08 when you are fetching the user from the db, why do you do a filter and then a first instead of simply a get()? Thanks!
filter(), whenever you expect more than just one object that matches your criteria. If no item was found matching your criteria, filter() returns am empty queryset without throwing an error.
get(), you expect one (and only one) item that matches your criteria.
Thus if there are more than one objects returned in queryset we would know that via filter
Legit helped me
Very Greeat Explanation Sir...ThankYou
Amazing tutorial, thank you very much!
Спасибо большое за урок! Очень помог!
Such a dope explanation 🔥🔥🔥
Thank you so much. It was a great help!
awesome video! Thank you!
Helps a lot.. Thanks buddy
The best (from morocco)
This was very helpful thank you
Super Helpful great tutorial. Thanks a lot.
This is Awesome, helpful for me. Thanks
Thanks for making this video.
Thank you for this. You are awesome!
Superb content, very helpful
just osm content and step by step explaination
Amazing tutorial dude
The cookies aren't saving automatically when I use ReactJs - Axios.
How can I save the cookies automatically and also send it as part of the request using Axios or Fetch API
Thank you for video! Can you tell what is the soft you use for DataBase on 06:42 ?
great explanation!
Great video! If I'm using Django templates instead of a separate front end, can I still use JWT for authentication?
I have to say THANK YOU!
very nice, thank you!!
The biggest THANK YOU!
Very well explained , Thanks
Thanks very will explanation
Thank you so so much brother
It is perfect tutorial, thank u, and continue.
you are a life save dude
can i ask u ?
thank you for this tutorial very much!
great tutorial! thumbs up!
This is not JWT but Token based authentication since it needs database migration but it is amazing.
Thanks helped a lot
GREAT Tutorial!
Great job, thanks!
Superb Content Bro
Good video!!
Does this work for multiple users getting logged in and out at the same time?
The best movie that I saw!
bruh
Tysm. Plz login using role such admin, user,student,teacher..plz make video on this
Excellent tutorial,
Came from freecodecamp
thanks, good video
thanks for high quality video, but i have a question for you~~
in the Userview part,, why you attech code -> ".first()" ??
when I want all of the logined people, how can i???
Because filter() returns a List and I add .first() to retrieve a single object. To get all the logged in users you have to store the jwt with the user_id in a database
@@ScalableScripts explain code??TT
great tutorial. How about the guard ?
amazing video
Thank you very much!
There's a issue with "utcnow()" function in newer django versions. My cookie instantly get deleted.
When you use IsAuthenticated permission class, it don't work. Can you explain why?
same issue im facing
Do you know how to use JWT auth in django's admin interface?
Thank you so much!
is that pyjwt assigns refresh token to user , just like simple jwt does ? also does it refresh tokens automatically after expiration time ?
Please, how can i use django default isAuthenticated permission instead of having to check if the token is in cookie.
I love this video!!!!! the best ever!
I can't seem to understand the purpose of the 'Authenticated User' section.
after setting username=None. i cant create superuser.
Could you fix it?
@@AshishSingh-dn8wb sorry dude. Workung with magento now.
Thank you! :)
Hey, I did this auth and now connecting it to Vue js frontend but when I sign out, I am still able to access protected views that need authentications. Only when I clear the browser cookie do the access stop. Also the cookie is still within the header when I sign out. How can I fix this? it work fine in postman.
Thank you so much
Does this work with a flutter frontend
Thanks but please do `NextAuth` with Django Rest Framework, with email and password. Also, adding OAuth on the same tutorial will be great. I am desperetely waiting for your response.