Generating Authentication Tokens (Django Rest framework TokenAuthentication)

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

CodingWithMitch

CodingWithMitch

Күн бұрын

Пікірлер: 83
@joseraulmachadofernandez9744
@joseraulmachadofernandez9744 2 жыл бұрын
One of the best Django tutorials channel. Thank you for this great course.
@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.
@miguelalbors9983
@miguelalbors9983 3 ай бұрын
Thanks Mitch! Just love the course
@karlasosa5304
@karlasosa5304 3 жыл бұрын
This is the best explanation I've found on this topic thank you so much!
@mister_stiv8411
@mister_stiv8411 2 жыл бұрын
Yes
@samucancld
@samucancld 2 жыл бұрын
No one explain this like you man, thanks
@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
@jimmyfl0
@jimmyfl0 2 жыл бұрын
Thank you! Such a clear explanation! I wish you taught swift as well lol.
@alirn7141
@alirn7141 4 жыл бұрын
Dude, Love this course :)
@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.
@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.
@FootyPick
@FootyPick 5 жыл бұрын
Thanks loving it can we do more project based on this
@KIRILLINGUSS21
@KIRILLINGUSS21 3 жыл бұрын
Your videos are great! Awesome course. Thanks, Mithc
@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...
@kingkesylo8516
@kingkesylo8516 4 жыл бұрын
MANNNN YOU ARE THE BEST OF BESTS. THANK YOU VERY MUUUUUUUUUUUUUUUUUUUCH
@darkcast345
@darkcast345 4 жыл бұрын
11:50 you can add token through the admin on the top right.
@codedbychavez8190
@codedbychavez8190 4 жыл бұрын
I love this tutorial, Thank you!
@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
@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 :)
@akhileshchander5307
@akhileshchander5307 4 жыл бұрын
Very helpful tutorial
@GurjeetSingh-wj5cd
@GurjeetSingh-wj5cd 4 жыл бұрын
Nicely explained 👍
@mister_stiv8411
@mister_stiv8411 2 жыл бұрын
Thanks for video
@leewilliam8606
@leewilliam8606 4 жыл бұрын
Can you add a video about JWT?
@sunapanareloaded7003
@sunapanareloaded7003 3 жыл бұрын
Really helpful 👍
@theshubhagrwl
@theshubhagrwl 4 жыл бұрын
Super helpful.
@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 4 жыл бұрын
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 5 ай бұрын
@@TheCecchino98 thank you really
@nirajankarki6626
@nirajankarki6626 4 жыл бұрын
Awesome , Subbed
@sergekossi3769
@sergekossi3769 4 жыл бұрын
Awesome tuto
@mohamedarafa9719
@mohamedarafa9719 3 жыл бұрын
Thank you so much
@francmape
@francmape 4 жыл бұрын
Thank you sooooo much. What about logout!
@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?
@petrice3461
@petrice3461 4 жыл бұрын
Hi Mitch,I recommend jwt
@hadramielbey8443
@hadramielbey8443 3 жыл бұрын
شكرا 💙
@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
@RizwanAli-bu5oy
@RizwanAli-bu5oy 5 жыл бұрын
How to create logout api in DRF?
@wanyoikedanny472
@wanyoikedanny472 2 жыл бұрын
following brightly
@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???
@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 4 жыл бұрын
What if the user is created under models.Model. can this still work. If not, is there's anyway to make it happen
@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
@bekzodnegmatillaev8974
@bekzodnegmatillaev8974 4 жыл бұрын
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.
@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 kzbin.info/www/bejne/ZpWalHycnt6Xd8U
@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?
@johna-h2m
@johna-h2m 4 жыл бұрын
your awesome
@classicguy7813
@classicguy7813 3 жыл бұрын
why the same token
@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.
@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
@PrAsHaNtHdUke1093
@PrAsHaNtHdUke1093 Жыл бұрын
hi sir is this permanent token?
@diego.coder26
@diego.coder26 4 жыл бұрын
django token vs jwt ?
@JESSUTORTO
@JESSUTORTO 3 жыл бұрын
does someone knows how to retrieve the token when registration in a viewSet?
@stackover1253
@stackover1253 2 жыл бұрын
can you please send me the source code
@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.
@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 М.
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 16 МЛН
Players vs Corner Flags 🤯
00:28
LE FOOT EN VIDÉO
Рет қаралды 91 МЛН
Un coup venu de l’espace 😂😂😂
00:19
Nicocapone
Рет қаралды 5 МЛН
Python Django REST API In 30 Minutes - Django Tutorial
30:42
PedroTech
Рет қаралды 19 М.
Authentication & Refreshing Tokens Implementation
2:09:53
Dennis Ivy
Рет қаралды 237 М.
GET, UPDATE, POST, DELETE - Function Views (Django REST framework)
17:45
Register a New User (Django Rest framework)
15:05
CodingWithMitch
Рет қаралды 81 М.
REST API Token Authentication for Mobile Apps
10:44
CodingWithMitch
Рет қаралды 107 М.
Django REST Framework Oversimplified
9:43
Dennis Ivy
Рет қаралды 330 М.
iOS Development is Easier than Android Development (VLOG)
20:41
CodingWithMitch
Рет қаралды 52 М.
Django API Authentication using JWT Tokens
37:06
Scalable Scripts
Рет қаралды 184 М.