JSON Web Tokens With Django REST Framework

  Рет қаралды 91,889

Pretty Printed

Pretty Printed

Күн бұрын

Пікірлер: 116
@prettyprinted
@prettyprinted 4 жыл бұрын
Join my free course on building a Todo API with Django REST Framework: prettyprinted.com/djangotodoapi
@aldemarocruz9668
@aldemarocruz9668 2 жыл бұрын
I think this is the best video with django anfd JWT
@auroshisray9140
@auroshisray9140 2 жыл бұрын
Thanks man...for the simple explanation
@Myskyink
@Myskyink 6 жыл бұрын
I have been following you since my days of learning flask. Your tutorials are simply the best. Please make videos on authentication, permission .
@prettyprinted
@prettyprinted 6 жыл бұрын
Will definitely cover those topics. Thanks for watching!
@minsukwon3833
@minsukwon3833 4 жыл бұрын
loved watching your series! thanks a lot
@prettyprinted
@prettyprinted 4 жыл бұрын
Thanks for watching!
@ABMA79
@ABMA79 Жыл бұрын
My dear friend, I am a great fan of your youtube channel since I am an intermediate Django framework user. I do have a question, when do we need to make API for our application? from What I have seen, it is not obligatory unless you plan to share data with other entities or end users. So can you please tell me the goal of enabling API briefly?
@medoabdin480
@medoabdin480 3 жыл бұрын
you are amazing Anthony you have a very good explanation style. bless you god
@johnquick7275
@johnquick7275 3 жыл бұрын
Outstanding video and explanation. Thank you.
@alexlindgren1
@alexlindgren1 3 жыл бұрын
Great tutorial series, really appreciated it!
@dutchprime1488
@dutchprime1488 3 жыл бұрын
Great tutorial, it helped me understand how the package works!
@mrmuranga
@mrmuranga 3 жыл бұрын
awesome.... thanks
@MiRaje8086
@MiRaje8086 3 жыл бұрын
thank you so much man
@thomasshowers6682
@thomasshowers6682 6 жыл бұрын
I think the reason your signature was invalid on jwt.io is because you weren't using the secret from your settings.py file. When you toggle the 'secret base64 encoded' option it creates a new token using "secret" as the secret (10:50). If you put the secret from settings.py in that box and paste your token again it should work with 'secret base64 encoded' unchecked.
@AryanGNU
@AryanGNU 4 жыл бұрын
You are awesome man, Thanks a ton
@veziop
@veziop 2 жыл бұрын
so if i understand correctly, this is a way of proviging an 'API token' for the users of our django REST API once we deploy it? I imagine in our documentation we include a step for acquiring the tokens only if the user inputs the relevant data into a POST method to '/api/token/' just as shown in this video. am i correct or am i missing something?
@tomouyt
@tomouyt 6 жыл бұрын
Great tutorial, straight to the point and with very good explanations.
@prettyprinted
@prettyprinted 6 жыл бұрын
Thanks for watching!
@fabricioaugusto6324
@fabricioaugusto6324 6 жыл бұрын
You saved my life. Thank you!
@prettyprinted
@prettyprinted 6 жыл бұрын
Glad i could help!
@serhii.chumachenko
@serhii.chumachenko 6 жыл бұрын
It's awesome! Thanks!
@prettyprinted
@prettyprinted 6 жыл бұрын
Thanks for watching!
@mrmuranga
@mrmuranga 5 жыл бұрын
Really simple to use......thanks Anthony... Compared with Django Rest Knox would you say JWT is more secure or faster ?
@MrIgorbpf
@MrIgorbpf 6 жыл бұрын
Great video, man! Could u do a series using djoser and JWT of the whole process of authentication? I men signup, login, password reset, email and etc. That would be awesome!
@prettyprinted
@prettyprinted 6 жыл бұрын
I'll look into djoser. Thanks for the idea.
@abirulezz
@abirulezz 6 жыл бұрын
oh yeah please do!
@sabitmahmud7652
@sabitmahmud7652 6 жыл бұрын
hello Anthony !!As SuperUser can create lots of user according to their roll but Using JWT with DRF returns a response for Refresh and Access token. But it is impossible to define which user it is ! How can I return or pass a value by which I can able to understand what type of user it is?
@nguyenconghuy3847
@nguyenconghuy3847 2 жыл бұрын
how can I declare which api need access token and which doesn't in django
@DANJUMA9
@DANJUMA9 6 жыл бұрын
Simple and short!!
@prettyprinted
@prettyprinted 6 жыл бұрын
Thanks for watching!
@johncollera
@johncollera 3 жыл бұрын
Can you write the code to POST and get the the token... so the code will automatically get the JWT and then use that to return the data
@stanleyjohn4670
@stanleyjohn4670 4 жыл бұрын
I want to use a LOGOUT API that logs out the current user and deletes/removes the existing access token. The access token has an expiration date of 1 year (my requirement) but can be deleted/expire once a user logs out. How can I do this?
@hariprakasham
@hariprakasham 4 жыл бұрын
hi I have a doubt .. from where you referred paradigms .. ?? this the source of paradigms is not displayed in this video ..
@jonathanma4501
@jonathanma4501 3 жыл бұрын
Hi, this was a great video. I have a question - like in the video, you created an access/refresh token with a given username and password. But what if you want to only allow some users to make the access/refresh token? For example, only paid users, or only users who have registered as an account? Would I have to implement logic in the views so that it checks with a database for preexisting users, or do I have to create a signed url to get access to make the token? What's the best way of restricting token creation? Or, should I have only a server side application connect to this resource api to create the access/refresh token, which I then pass to the frontend as a response?
@veziop
@veziop 2 жыл бұрын
i find this question interesting
@abhishektayal480
@abhishektayal480 2 жыл бұрын
For that we have to use permissions along with jwt.
@toufanialfarisi1866
@toufanialfarisi1866 5 жыл бұрын
it's really really awesome
@prettyprinted
@prettyprinted 5 жыл бұрын
Thanks!
@highskill
@highskill 6 жыл бұрын
Thank you! 🙌
@dgiri2333
@dgiri2333 5 жыл бұрын
Hi how to create nested serializer like if select district then it's show model list ,if model select all village can show on villages how to implement
@dcatalyst6271
@dcatalyst6271 4 жыл бұрын
hey can you make a Django snowflake database connection video I have searched allot but not found the solution anywhere
@harshilgohil3918
@harshilgohil3918 5 жыл бұрын
Hello!, After installing djangorestframework_simplejwt and after updating 'DEFAULT_AUTHENTICATION_CLASSES' in settings.py and adding proper imports in urls.py .I am getting a ModuleNotFoundError: No module named 'rest_framework_simplejwt'. Is there any other dependency I need to install? Thanks in advance!
@stev3886
@stev3886 4 жыл бұрын
Did you install it in the right virtual environment? sometimes people made this mistake
@msasoftware
@msasoftware 5 жыл бұрын
:) Excelent. Thanks you so much
@blog.pymastery
@blog.pymastery 5 жыл бұрын
Everything is well done. However, why I can't access Django Database essential, it says that 404 page not found !? Help, please.
@victorazuara3346
@victorazuara3346 6 жыл бұрын
Excellent, thank you
@prettyprinted
@prettyprinted 6 жыл бұрын
You're welcome. Thanks for watching.
@akshhay
@akshhay 4 жыл бұрын
How to implement this in a form in django?
@kutluaydn1508
@kutluaydn1508 3 жыл бұрын
I don't want to use library for jwt. Is there any source for python jwt?
@chesterholt5551
@chesterholt5551 5 жыл бұрын
Superb
@prettyprinted
@prettyprinted 5 жыл бұрын
Thanks for watching.
@xtremehackerzpro9511
@xtremehackerzpro9511 6 жыл бұрын
Excellent :)
@whateverreally
@whateverreally 4 жыл бұрын
Hey dude, I'm getting an error, just gonna paste it here: HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /authors (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 111] Connection refused',)) This occurs when I'm tryna run the send.py file. Can you let me know what I can do? I kinda need help asap. Thanks bruh.
@whateverreally
@whateverreally 4 жыл бұрын
FYI, I did not use POSTMAN, I got the token directly from the website after I entered the login credentials.
@bravmi
@bravmi 6 жыл бұрын
You rock dude
@prettyprinted
@prettyprinted 6 жыл бұрын
Thanks for watching!
@wayneloo8234
@wayneloo8234 6 жыл бұрын
That's really cool. But I think the user login is validating against the user model in the database. What if we're using external methods like ldap? How does it work? Do you have a video on that?
@prettyprinted
@prettyprinted 6 жыл бұрын
No video on ldap, but I'll consider it for the future.
@CerebroVasconcelos
@CerebroVasconcelos 5 жыл бұрын
Thanks for to do this video
@prettyprinted
@prettyprinted 5 жыл бұрын
You're welcome! Thanks for watching.
@nurizzati5892
@nurizzati5892 5 жыл бұрын
i hope you do token based authentication with django rest framework
@prettyprinted
@prettyprinted 5 жыл бұрын
I'll probably cover that in the future.
@rayaangrewal1035
@rayaangrewal1035 5 жыл бұрын
awesome
@ChantOfSpirit
@ChantOfSpirit 5 жыл бұрын
Author, what I should do with {% csrf_token %} template tag ? I can't remove it... How I can use my login/logout forms with new token?
@ZainAli-me4qk
@ZainAli-me4qk 4 жыл бұрын
Can you please tell me how to create multi-users like Sellers buyers and admin with their roles i need model and serializers for 3 users model. Please help
@shubhamkumar9484
@shubhamkumar9484 4 жыл бұрын
from where paradigms came i lost it there
@politicallynotcorrect2968
@politicallynotcorrect2968 4 жыл бұрын
how do i create a routh only for auth users
@learnwithfun147
@learnwithfun147 6 жыл бұрын
Hey Pretty good job man. Can you do Class Based View tuths. Waiting for it :)
@prettyprinted
@prettyprinted 6 жыл бұрын
Yep, that's on the list. Thanks for watching.
@Skaxarrat
@Skaxarrat 6 жыл бұрын
I did this series two times, from scratch, but when I get to this point I start to have issues. I've 'pip installed' rest_framework_simplejwt', added it to settings.py and created the two endpoints to 'api/token' and 'api/token/refresh', yet I still don't get the 'Authentication credentials are not provided' message. Anyone is having the same issue as me and fixed it? Keep in mind I've tried this two times from scratch
@fester6537
@fester6537 6 жыл бұрын
From what I can tell your permission is set to 'permissions.IsAuthenticatedOrReadOnly' instead of 'permissions.IsAuthenticated'. It should works if you change both permission in your settings.py and your LanguageView.
@niteshrawat576
@niteshrawat576 6 жыл бұрын
are declaring permission class as AllowAny or authentication class as IsAuthorizedOrReadOnly? If yes, then please don't.
@davidmutua6971
@davidmutua6971 5 жыл бұрын
Actually this is not a problem you must make sure first your local django development server is running. The message may vary like mine too doesn't show that when I post using postman but it does when using "Insomnia" software. It's similar to postman but simpler. Postman is a beast though.
@ahadulislam8891
@ahadulislam8891 5 жыл бұрын
Nice Video bro. But is there any way to use JWT without DRF(Django Rest Framework ). Thank You
@prettyprinted
@prettyprinted 5 жыл бұрын
Yeah, check out my JWT videos with Flask. The concept will be the same in Django.
@sankarbathula8758
@sankarbathula8758 6 жыл бұрын
Thanks a lot...!
@prettyprinted
@prettyprinted 6 жыл бұрын
You're welcome! Thanks for watching.
@amirshehzad3352
@amirshehzad3352 5 жыл бұрын
@Pretty Printed How are you connecting python in Ubuntu Bash with VScode?
@prettyprinted
@prettyprinted 5 жыл бұрын
I don't actually. I keep them separate. I eventually need to connect them though.
@msasoftware
@msasoftware 5 жыл бұрын
More options in: www.django-rest-framework.org/api-guide/authentication/#third-party-packages
@georgesmith3022
@georgesmith3022 5 жыл бұрын
by default, for how long is the token valid?
@prettyprinted
@prettyprinted 5 жыл бұрын
Five minutes. You can see the defaults here: github.com/davesque/django-rest-framework-simplejwt#settings
@georgesmith3022
@georgesmith3022 5 жыл бұрын
@@prettyprinted thanks
@nagaraja4846
@nagaraja4846 5 жыл бұрын
how can i generate jwt custom token for django api...Thank You Advance.
@manhha3010932
@manhha3010932 6 жыл бұрын
Hi! I'm counfusing after learn Django Rest framework, what django REST do? how to render those data to front end? because this is just pure data, how to use it in front? I am beginer so sorry if dumb question, thanks !
@prettyprinted
@prettyprinted 6 жыл бұрын
If you want to display data, you can use the traditional template features of Django. Another way to render pure data is by using a frontend framework like React. I recommend looking into templates first though.
@sumitprakash2747
@sumitprakash2747 4 жыл бұрын
Hi I am getting ModuleNotFoundError at / No module named 'rest_framework_simplejwt'
@kancharlanikhilsai9838
@kancharlanikhilsai9838 6 жыл бұрын
I was looking for this type of video and got yours. Excellent video. Thank you so much. The username and password are from auth_user table in db. Is there any way to take username and password from another table we create for storing users.
@prettyprinted
@prettyprinted 6 жыл бұрын
Everything in DRF can be customized, but it takes more code. But yeah, you can change to a different database.
@kancharlanikhilsai9838
@kancharlanikhilsai9838 6 жыл бұрын
where to modify the code to get the user details along with the tokens generated.
@mdk124
@mdk124 4 жыл бұрын
@@prettyprinted Is there a direction that we can look at for this?
@mdk124
@mdk124 4 жыл бұрын
@@kancharlanikhilsai9838 Hi! Did you manage to solve this issue you were facing?
@JonesDTaylor
@JonesDTaylor 6 жыл бұрын
Hi Anthony Your videos are nice. Can you please show the audiance where do you get your code from ? for instance the settings.py changes for token authentication. It helps if you show the location (obviousily from the official doc of restframework) from which you get the code. Thank you
@prettyprinted
@prettyprinted 6 жыл бұрын
It's not practical for me to give all the locations in the docs, but the extension's documentation isn't too complicated so you should be able to see if it you go to the relevant section.
@alexanderlabrador5608
@alexanderlabrador5608 6 жыл бұрын
how can I consume this api from a fronent or an html with ajx ?
@swaali1
@swaali1 6 жыл бұрын
hello , can i use it for cb token adder thankssssssssssssss
@amangautam6662
@amangautam6662 5 жыл бұрын
When i'm trying to get access token and refresh token using curl command curl -X POST -H "Content-Type: application/json" -d '{"username":"myusername", "password":"mypassword"}' localhost:8000/api/token/ i'm getting error username and password this field is required but it is working with postman api testing
@frostsmaker8966
@frostsmaker8966 4 жыл бұрын
How to get user_id from the access token/ authenticated user in views.py?? I want to use the object manager to get data using user_id.
@christianmagnus1003
@christianmagnus1003 4 жыл бұрын
Hello buddy, i have a questions, that username and password was by the Admin user really? i mean that token is only for superuser in django rest framework, not for normal users yes?
@huzaifquazi
@huzaifquazi 4 жыл бұрын
how can i get token for user and not admin ?
@georgesmith3022
@georgesmith3022 5 жыл бұрын
are the google api keys jwt tokens?
@prettyprinted
@prettyprinted 5 жыл бұрын
No, they're tokens specific to Google.
@georgesmith3022
@georgesmith3022 5 жыл бұрын
@@prettyprinted thanks for answering
@SidonDuarte
@SidonDuarte 6 жыл бұрын
What is the differences between "django-rest-framework-jwt' and "django-rest-framework-simplejwt ( github.com/davesque/django-rest-framework-simplejwt ), what its advantages and drawbacks for each one?
@prettyprinted
@prettyprinted 6 жыл бұрын
Generally the differences between any similar libraries are just the patterns. So try out both and see which pattern you like best.
@oluwafemimatthew3501
@oluwafemimatthew3501 6 жыл бұрын
Is there any reason behind your choice of github.com/davesque/django-rest-framework-simplejwt as against a more established github.com/GetBlimp/django-rest-framework-jwt. Nice video by the way, clear and concise
@prettyprinted
@prettyprinted 6 жыл бұрын
No particular reason. If you can use, then you should be able to figure out the other. Thanks for watching.
@gopalsivethna2959
@gopalsivethna2959 6 жыл бұрын
hello sir i am brown person and u r smartents black person i know, thanks for the help!
@prettyprinted
@prettyprinted 6 жыл бұрын
Umm thanks.
@estebanmejia9989
@estebanmejia9989 4 жыл бұрын
Great, please enumerate your videos.
@eduardorodriguezperez704
@eduardorodriguezperez704 6 жыл бұрын
pip install djangorestframework_simplejwt
@eshaanbansal9122
@eshaanbansal9122 4 жыл бұрын
Flask > Django.
How to Use a Postgres Database in Django
7:06
Pretty Printed
Рет қаралды 105 М.
What Is JWT and Why Should You Use JWT
14:53
Web Dev Simplified
Рет қаралды 1,2 МЛН
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 93 МЛН
SISTER EXPOSED MY MAGIC @Whoispelagheya
00:45
MasomkaMagic
Рет қаралды 18 МЛН
Cool Parenting Gadget Against Mosquitos! 🦟👶 #gen
00:21
TheSoul Music Family
Рет қаралды 33 МЛН
Getting Started With Django REST Framework
26:31
Pretty Printed
Рет қаралды 199 М.
Django API Authentication using JWT Tokens
37:06
Scalable Scripts
Рет қаралды 187 М.
Authentication & Refreshing Tokens Implementation
2:09:53
Dennis Ivy
Рет қаралды 240 М.
How to Use Django REST Framework Permissions
11:06
Pretty Printed
Рет қаралды 40 М.
Next.js and Django JWT Authentication | Part 1 - Backend API
3:26:36
Django Authentication Basics
19:38
Pretty Printed
Рет қаралды 109 М.
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 93 МЛН