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?
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!
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
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.
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.
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
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"])
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?
This was the best video I've watched on UA-cam about Authentication using JWT Tokens. Thank you so much!
Truly the smoothest and most accurate Django-JWT Tutorial I've ever seen!!!
The best token based Authentication I have watched. Very detailed. Thank you
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
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?
Perfect Tutorial for basic auth so far. Loved it! Keep it up Sir! 💖
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.
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 for the clear explanation. Bdw, what about the refresh token.. don't we need that as well ??
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.
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 ?
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
Awesome! thanks for your explanation. I just want to remind these typical topics for django, it always important to continue improving our skills.
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
Very good video! Without getting lost in the bush, getting to the concept clearly
Greetings from Argentina!
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
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.
Video Explanation is Really amazingly. But Why there is no refresh token??
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
This is an amazing video. So clear. Answered most of my questions before I asked them.
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
thank you so much for the video, because of this now i and my group can sleep in peace hahahaha
How can I create super users?
What about CSRF policies and securities, Why are they not applied here?
super straightforward and concise, great job!
Great video! If I'm using Django templates instead of a separate front end, can I still use JWT for authentication?
best teacher ever
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
The best explainantion and ONPOINT, loved it, Thank you 🙏
The best (from morocco)
Thank you for video! Can you tell what is the soft you use for DataBase on 06:42 ?
Excellent work. Thank you
you are a life save dude
can i ask u ?
Does this work for multiple users getting logged in and out at the same time?
I have to say THANK YOU!
Such a dope explanation 🔥🔥🔥
Great content, subscribed !
very helpful video and keeping it simple tthanks!
you can change
instead of
User.objects.filter(id=id).first()
you can
User.objects.get(pk=id)
and thank for the tuto, I'll watch the svelte part now :)
Need help! When passing a foreign key as the id to the payload, it states Type Error and not JSON serializable.
Does this work with a flutter frontend
that was really helpful, and very straightforward! Thank you so much.
I learnt a lot here Thank You !!!
When you use IsAuthenticated permission class, it don't work. Can you explain why?
same issue im facing
The biggest THANK YOU!
Thanks a lot good man!
God always bless you!
Many Many Thanks For you good man!
Спасибо большое за урок! Очень помог!
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
This is tutorials is awesome.. Thanks a lot
Thanks for making this video.
Tysm. Plz login using role such admin, user,student,teacher..plz make video on this
This is not JWT but Token based authentication since it needs database migration but it is amazing.
thank you very much. excellent presentation of the material
Thank you for this. You are awesome!
just osm content and step by step explaination
awesome video! Thank you!
great tutorial. How about the guard ?
Legit helped me
Amazing tutorial dude
great explanation!
I love this video!!!!! the best ever!
Helps a lot.. Thanks buddy
Amazing tutorial, thank you very much!
Very Greeat Explanation Sir...ThankYou
Thank you so much. It was a great help!
GREAT Tutorial!
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.
Superb content, very helpful
Very well explained , Thanks
is that pyjwt assigns refresh token to user , just like simple jwt does ? also does it refresh tokens automatically after expiration time ?
Good video!!
Super Helpful great tutorial. Thanks a lot.
very nice, thank you!!
Thanks very will explanation
Superb Content Bro
There's a issue with "utcnow()" function in newer django versions. My cookie instantly get deleted.
Great job, thanks!
great tutorial! thumbs up!
This was very helpful thank you
This is Awesome, helpful for me. Thanks
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.
Do you know how to use JWT auth in django's admin interface?
The best movie that I saw!
bruh
Thank you so so much brother
Please, how can i use django default isAuthenticated permission instead of having to check if the token is in cookie.
where are the token stored ? in the user table ??
thank alot this is what i am looking for, but how to update the user data ?
Excellent tutorial,
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.
Thanks helped a lot
Came from freecodecamp
Is it refreshing jwt token automatically after expiry?
how to use jwt with other models ?
can you please make a video or help on it
Thank you very much!
thank you for this tutorial very much!
It is perfect tutorial, thank u, and continue.