Тёмный

Generating Authentication Tokens (Django Rest framework TokenAuthentication) 

CodingWithMitch
Подписаться 145 тыс.
Просмотров 95 тыс.
50% 1

Django Rest-framework playlist: bit.ly/2JI909W
High quality programming courses: codingwithmitch.com/courses
In this video I take you through Token Authentication with the django rest framework.
I show you what is "means" to be authenticated and how to use the different django rest framework authentication classes.
#djangorestframework #restapi
Code: codingwithmitch.com/courses/b...
Instagram: / codingwithmitch

Наука

Опубликовано:

 

28 июн 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 83   
@joseraulmachadofernandez9744
One of the best Django tutorials channel. Thank you for this great course.
@KIRILLINGUSS21
@KIRILLINGUSS21 3 года назад
Your videos are great! Awesome course. Thanks, Mithc
@alirn7141
@alirn7141 4 года назад
Dude, Love this course :)
@miguelalbors9983
@miguelalbors9983 14 дней назад
Thanks Mitch! Just love the course
@samucancld
@samucancld Год назад
No one explain this like you man, thanks
@karlasosa5304
@karlasosa5304 2 года назад
This is the best explanation I've found on this topic thank you so much!
@mister_stiv8411
@mister_stiv8411 2 года назад
Yes
@codedbychavez8190
@codedbychavez8190 4 года назад
I love this tutorial, Thank you!
@FootyPick
@FootyPick 5 лет назад
Thanks loving it can we do more project based on this
@kingkesylo8516
@kingkesylo8516 4 года назад
MANNNN YOU ARE THE BEST OF BESTS. THANK YOU VERY MUUUUUUUUUUUUUUUUUUUCH
@GurjeetSingh-wj5cd
@GurjeetSingh-wj5cd 3 года назад
Nicely explained 👍
@jimmyfl0
@jimmyfl0 Год назад
Thank you! Such a clear explanation! I wish you taught swift as well lol.
@anshul8569
@anshul8569 3 года назад
You can run ----> python manage.py drf_create_token username in your development server to generate token for a specific user as well.
@nirajankarki6626
@nirajankarki6626 3 года назад
Awesome , Subbed
@akhileshchander5307
@akhileshchander5307 3 года назад
Very helpful tutorial
@sunapanareloaded7003
@sunapanareloaded7003 3 года назад
Really helpful 👍
@sergekossi3769
@sergekossi3769 4 года назад
Awesome tuto
@theshubhagrwl
@theshubhagrwl 3 года назад
Super helpful.
@ivonherms
@ivonherms 3 года назад
Thank you for the tutorial Mitch! I just want to ask how I can fetch the data from the REST API? I mean I can Login or Get the data or even insert a data using Postman. But how can I do it using Django? For example, I made another Django Website and I want to use the REST API that I made from my first website. How can I do it? Thanks again :)
@darkcast345
@darkcast345 4 года назад
11:50 you can add token through the admin on the top right.
@mister_stiv8411
@mister_stiv8411 2 года назад
Thanks for video
@alexseydugin8109
@alexseydugin8109 Год назад
About username, you can rewrite to your own obtain token view, you just need to copy past obtain token view and replace username with email.
@mohamedarafa9719
@mohamedarafa9719 3 года назад
Thank you so much
@leewilliam8606
@leewilliam8606 4 года назад
Can you add a video about JWT?
@bibekshrestha9205
@bibekshrestha9205 4 года назад
Could you please make the course of flutter using django api!? I love your courses
@badactor7071
@badactor7071 2 года назад
Feel your pain brotha... I chose Django and flutter for my final year project too...
@francisakilimali72
@francisakilimali72 3 года назад
Thank you sooooo much. What about logout!
@valanikevin
@valanikevin 3 года назад
The video is amazing. So helpful. But the only thing I didn't like is that he recommended deleting all users to generate Tokens. I mean what if you have 4300 Registration for your website?
@oruchkin
@oruchkin 2 года назад
generate token when your users login, so you dont need to delete old guys
@petrice3461
@petrice3461 4 года назад
Hi Mitch,I recommend jwt
@johnx112
@johnx112 4 года назад
your awesome
@floridaman5295
@floridaman5295 Год назад
To work around deleting the superuser to generate a token for them you can temporally remove the 'if created' statement in the post_save receiver, login and update the user settings. Chances are you will get a duplicate error by that point. This leads me to believe simply logging in generates it.
@hadramielbey8443
@hadramielbey8443 3 года назад
شكرا 💙
@Tauseef
@Tauseef 3 года назад
When working with microservices how will the token authentication work with different service, for example I have ecommerce, forum as different services. So how can I authenticate the Tokens between different services?
@ranjithsankar3010
@ranjithsankar3010 4 года назад
hey by registering a new user, it has the role of admin right? means using that credentials we can login to admin panel, right?
@RizwanAli-bu5oy
@RizwanAli-bu5oy 4 года назад
How to create logout api in DRF?
@jhoniemusic
@jhoniemusic 3 года назад
What if the user is created under models.Model. can this still work. If not, is there's anyway to make it happen
@mahatibharadwaj3230
@mahatibharadwaj3230 3 года назад
how do you read that token from the request in function api view? The token is generated from outside Django application but is included in the header. The user id also authenticated outside django. So I do not want to send the username and password for Authentication.
@bekzodnegmatillaev8974
@bekzodnegmatillaev8974 3 года назад
how to implement that create_auth_token() function with APIView?
@wanyoikedanny472
@wanyoikedanny472 2 года назад
following brightly
@TheStoicPlayer64
@TheStoicPlayer64 3 года назад
To generate tokens for already created users do this :- > python manage.py shell >>>from django.contrib.auth.models import User >>>from rest_framework.authtoken.models import Token >>>for user in User.objects.all(): ... Token.objects.get_or_create(user=user) ...
@skpaik
@skpaik 4 года назад
Hi Mitch, Nice tutorials. Can you suggest me a tutorial about passwordless authentication in drf base web application?
@codingwithmitch
@codingwithmitch 4 года назад
Never done that
@JESSUTORTO
@JESSUTORTO 3 года назад
does someone knows how to retrieve the token when registration in a viewSet?
@junevue9665
@junevue9665 2 года назад
Is this how do authentication to all api endpoints
@usmanimtiaz1519
@usmanimtiaz1519 4 года назад
it show error at:token = Token.objects.get(user=account) account is not defined
@zahrahosseini5880
@zahrahosseini5880 3 года назад
I followed the tutorial completely but I encounter this error in postman "Cannot query "example@yahoo.com": Must be "User" instance.can anyone help me?
@nikonmohapatra6853
@nikonmohapatra6853 2 года назад
A good video but a small correction: username becomes a required field because in definition you have REQUIRED_FIELDS = ['username'] . Without that username is not required
@winningtech5
@winningtech5 Год назад
NO it does,nt make it a required field. check the documentation. you require that to make the email the primary login field
@HyacintheKouadio
@HyacintheKouadio 4 года назад
I followed the tutorial completely, I even downloaded it but I encounter this error in postman "non_field_errors": [ "Unable to log in with provided credentials." ] } Can you help me please ?
@valentinfontanger4962
@valentinfontanger4962 4 года назад
create a new user and then fill the form with the credentials
@TheCecchino98
@TheCecchino98 3 года назад
dunno if you might still need this, but i had the same problem and the reason was that my passwords weren't hashed during registration. Watch the previous tutorial and make sure you call set_password() in your registration serializer
@adj-xw1je
@adj-xw1je Месяц назад
@@TheCecchino98 thank you really
@diego.coder26
@diego.coder26 4 года назад
django token vs jwt ?
@dawoodamir2011
@dawoodamir2011 4 года назад
Nice shirt dude
@codingwithmitch
@codingwithmitch 4 года назад
You live near whistler BC?
@dawoodamir2011
@dawoodamir2011 4 года назад
No i actually lives in asia
@dawoodamir2011
@dawoodamir2011 4 года назад
Can u please tell me one thing
@ba-en1io
@ba-en1io 3 года назад
hi! I am able to generate the token for admin, but not for other users. do you have an idea why and is anyone else having this problem? and I am also getting error ValueError: Cannot query "bisma@hotmail.com": Must be "User" instance.
@syrgakomuraliev
@syrgakomuraliev 3 года назад
13:50 - what does .key method do? I thought we have only keys()
@D0ni3cz
@D0ni3cz 2 года назад
its an attribute of the "Token" object.
@PrAsHaNtHdUke1093
@PrAsHaNtHdUke1093 Год назад
hi sir is this permanent token?
@mahipalsingh9361
@mahipalsingh9361 4 года назад
Is there a way to make sure that a token will expire if a request is not sent in 10 minutes from last request with token?
@himanshupoddar1395
@himanshupoddar1395 4 года назад
someone??
@KushanVora
@KushanVora 4 года назад
Came here looking for an answer for this
@mahipalsingh9361
@mahipalsingh9361 4 года назад
I think django-expiring-token is worth looking into it will extend the expiration time with each new request and we can set the time for token so if we set 10 mins it will expire the token if there has been no request in last 10 minutes And if there is any request after 2 minutes of token generation then the time will extend to next 10 minutes
@teamexplorer2865
@teamexplorer2865 2 года назад
Method \"GET\" not allowed.
@parrot785
@parrot785 4 года назад
In 0:55 it's said that every time the user logs in, the token is generated. I get same token returned after every login. Apparently the token is generated only one time. Anyway I like this course!
@codingwithmitch
@codingwithmitch 4 года назад
Yes you're right I goofed on that. You can configure it to generate a new token every time. But I did not.
@rafsananwar3308
@rafsananwar3308 4 года назад
do you get the same token after doing logout and re-login???
@classicguy7813
@classicguy7813 2 года назад
why the same token
@stackover1253
@stackover1253 Год назад
can you please send me the source code
@poojanshah868
@poojanshah868 4 года назад
Can't we generate new token every time user logins?
@codingwithmitch
@codingwithmitch 4 года назад
Yep, I think that's a good idea.
@poojanshah868
@poojanshah868 4 года назад
@@codingwithmitch Well, Thanks for your reply but I am stuck there as it throws error if I try to generate new token for same user. Can you help me sharing any link or code snippet how should I do that! It will be a great help. Thanks in advance.
@valdrinkuchi435
@valdrinkuchi435 4 года назад
​@@poojanshah868 "Knox token authentication" hope it helps have a look at this link ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-0d7cIfiydAc.html
@maximemoreau711
@maximemoreau711 4 года назад
This tutorial is not bad, but from a security perspective it's really BAD! Please consider what you're doing before publishing... talk a little bit about the risks of lifetime tokens.
@mohamedabdi8377
@mohamedabdi8377 4 года назад
Can you please explain? What would you suggest from a security point of view? I would like to benefit from your recommendation. Thank you.
Далее
Django API Authentication using JWT Tokens
37:06
Просмотров 169 тыс.
Django Rest Framework for Beginners - Simple CRUD API
14:22
Token Authentication in Django REST Framework (Hindi)
1:09:27
Django Login using Access & Refresh Tokens
31:38
Просмотров 14 тыс.
Token Authentication with Django REST Framework | 2023
1:14:47
Login and Logout - Django Wednesdays ECommerce 7
20:33