No video

Generating Authentication Tokens (Django Rest framework TokenAuthentication)

  Рет қаралды 95,410

CodingWithMitch

CodingWithMitch

Күн бұрын

Пікірлер: 83
@joseraulmachadofernandez9744
@joseraulmachadofernandez9744 2 жыл бұрын
One of the best Django tutorials channel. Thank you for this great course.
@miguelalbors9983
@miguelalbors9983 2 ай бұрын
Thanks Mitch! Just love the course
@samucancld
@samucancld 2 жыл бұрын
No one explain this like you man, thanks
@karlasosa5304
@karlasosa5304 3 жыл бұрын
This is the best explanation I've found on this topic thank you so much!
@mister_stiv8411
@mister_stiv8411 2 жыл бұрын
Yes
@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.
@jimmyfl0
@jimmyfl0 Жыл бұрын
Thank you! Such a clear explanation! I wish you taught swift as well lol.
@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.
@alirn7141
@alirn7141 4 жыл бұрын
Dude, Love this course :)
@KIRILLINGUSS21
@KIRILLINGUSS21 3 жыл бұрын
Your videos are great! Awesome course. Thanks, Mithc
@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
@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...
@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.
@kingkesylo8516
@kingkesylo8516 4 жыл бұрын
MANNNN YOU ARE THE BEST OF BESTS. THANK YOU VERY MUUUUUUUUUUUUUUUUUUUCH
@FootyPick
@FootyPick 5 жыл бұрын
Thanks loving it can we do more project based on this
@ivonherms
@ivonherms 4 жыл бұрын
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 :)
@codedbychavez8190
@codedbychavez8190 4 жыл бұрын
I love this tutorial, Thank you!
@wanyoikedanny472
@wanyoikedanny472 2 жыл бұрын
following brightly
@darkcast345
@darkcast345 4 жыл бұрын
11:50 you can add token through the admin on the top right.
@mister_stiv8411
@mister_stiv8411 2 жыл бұрын
Thanks for video
@akhileshchander5307
@akhileshchander5307 4 жыл бұрын
Very helpful tutorial
@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 3 ай бұрын
@@TheCecchino98 thank you really
@GurjeetSingh-wj5cd
@GurjeetSingh-wj5cd 4 жыл бұрын
Nicely explained 👍
@TheStoicPlayer64
@TheStoicPlayer64 4 жыл бұрын
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) ...
@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
@sunapanareloaded7003
@sunapanareloaded7003 3 жыл бұрын
Really helpful 👍
@theshubhagrwl
@theshubhagrwl 4 жыл бұрын
Super helpful.
@leewilliam8606
@leewilliam8606 4 жыл бұрын
Can you add a video about JWT?
@nirajankarki6626
@nirajankarki6626 4 жыл бұрын
Awesome , Subbed
@junevue9665
@junevue9665 2 жыл бұрын
Is this how do authentication to all api endpoints
@sergekossi3769
@sergekossi3769 4 жыл бұрын
Awesome tuto
@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?
@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
@francmape
@francmape 4 жыл бұрын
Thank you sooooo much. What about logout!
@RizwanAli-bu5oy
@RizwanAli-bu5oy 4 жыл бұрын
How to create logout api in DRF?
@mohamedarafa9719
@mohamedarafa9719 3 жыл бұрын
Thank you so much
@hadramielbey8443
@hadramielbey8443 3 жыл бұрын
شكرا 💙
@bekzodnegmatillaev8974
@bekzodnegmatillaev8974 3 жыл бұрын
how to implement that create_auth_token() function with APIView?
@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.
@petrice3461
@petrice3461 4 жыл бұрын
Hi Mitch,I recommend jwt
@usmanimtiaz1519
@usmanimtiaz1519 4 жыл бұрын
it show error at:token = Token.objects.get(user=account) account is not defined
@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
@classicguy7813
@classicguy7813 3 жыл бұрын
why the same token
@teamexplorer2865
@teamexplorer2865 3 жыл бұрын
Method \"GET\" not allowed.
@zahrahosseini5880
@zahrahosseini5880 4 жыл бұрын
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?
@JESSUTORTO
@JESSUTORTO 3 жыл бұрын
does someone knows how to retrieve the token when registration in a viewSet?
@PrAsHaNtHdUke1093
@PrAsHaNtHdUke1093 Жыл бұрын
hi sir is this permanent token?
@johnx112
@johnx112 4 жыл бұрын
your awesome
@syrgakomuraliev
@syrgakomuraliev 3 жыл бұрын
13:50 - what does .key method do? I thought we have only keys()
@D0ni3cz
@D0ni3cz 3 жыл бұрын
its an attribute of the "Token" object.
@diego.coder26
@diego.coder26 4 жыл бұрын
django token vs jwt ?
@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.
@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
@stackover1253
@stackover1253 2 жыл бұрын
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 kzfaq.info/get/bejne/ZspnlqyXzt_IcZc.html
@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???
@dawoodamir2011
@dawoodamir2011 5 жыл бұрын
Nice shirt dude
@codingwithmitch
@codingwithmitch 5 жыл бұрын
You live near whistler BC?
@dawoodamir2011
@dawoodamir2011 5 жыл бұрын
No i actually lives in asia
@dawoodamir2011
@dawoodamir2011 5 жыл бұрын
Can u please tell me one thing
@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.
Restricting Access with Permissions (Django Rest framework)
10:03
CodingWithMitch
Рет қаралды 31 М.
Django REST JWT authentication |  Simple JWT
14:41
Code Aura
Рет қаралды 36 М.
managed to catch #tiktok
00:16
Анастасия Тарасова
Рет қаралды 48 МЛН
How I Did The SELF BENDING Spoon 😱🥄 #shorts
00:19
Wian
Рет қаралды 37 МЛН
Schoolboy Runaway в реальной жизни🤣@onLI_gAmeS
00:31
МишАня
Рет қаралды 4 МЛН
Ik Heb Aardbeien Gemaakt Van Kip🍓🐔😋
00:41
Cool Tool SHORTS Netherlands
Рет қаралды 9 МЛН
Django Login using Access & Refresh Tokens
31:38
Scalable Scripts
Рет қаралды 15 М.
Django Rest Framework | Serializers & CRUD
22:40
Dennis Ivy
Рет қаралды 385 М.
Advice from a Principal Software Engineer at Amazon (Steve Huynh)
22:45
Serializers (Django REST framework)
6:30
CodingWithMitch
Рет қаралды 114 М.
DO NOT do this in a Software Engineering Interview
7:59
CodingWithMitch
Рет қаралды 9 М.
How do server side authentication sessions work (express & cookies)
15:26
Django REST Framework - Build an API from Scratch
40:39
Caleb Curry
Рет қаралды 214 М.
managed to catch #tiktok
00:16
Анастасия Тарасова
Рет қаралды 48 МЛН