Comments (6)
For others with this issue: In an existing app with multiple authentication backends (including login by email), I was confused when I passed "email" and "password" fields and DRF-simplejwt returned {"username":["This field is required."]}
.
All I had to do was pass the email as the username — don't change the field name to 'email'.
from djangorestframework-simplejwt.
@whatcould Right. The login serializer just uses the username field defined on the user model. I don't think there's any way it could properly account for the behavior of non-standard authentication backends.
from djangorestframework-simplejwt.
+1 from me. However, I don't think this is an issue but rather a feature?
from djangorestframework-simplejwt.
Authentication is done using the authenticate method of django.contrib.auth. Therefore you can modify its behaviour by modifying the AUTHENTICATION_BACKENDS setting in settings.py.
Your question has nothing to do with this package, please close.
from djangorestframework-simplejwt.
What @gabn88 says is correct, actually. Take a look here. Will close this since it seems out of scope for simple jwt.
from djangorestframework-simplejwt.
Based on stackowerflow answer https://stackoverflow.com/questions/37332190/django-login-with-email
use this link for update default User model and change username
field to email
https://stackoverflow.com/questions/37332190/django-login-with-email
from djangorestframework-simplejwt.
Related Issues (20)
- How setup AWS Cognito with djangorestframework-simplejwt HOT 2
- CVE-2024-22513 HOT 1
- Security Issue HOT 3
- `Token` subclass' `for_user` method is typed to return a `Token` HOT 1
- encrypt username instead of user_id HOT 1
- The translation of the message "No active account found with the given credentials" does not work in various locales HOT 1
- TokenRefreshView doesn't register token_blacklist_outstandingtoken HOT 2
- How can we return custom JWT from dj-rest-auth instead of the session key HOT 1
- django5.0 is currently not supported HOT 1
- Why Outstanding token exist and why it stores raw refresh token
- Reported vulnerability in 5.3.1 HOT 3
- request.user.is_superuser and request.user.is_staff are False HOT 3
- Allow adding more field to payload of encoded `token` HOT 2
- Add JSON_ENCODER to the doc
- Can django 5.0 be used? Just use basic verification methods HOT 7
- TokenRefreshView should prevent users from refreshing token if the user is inactive
- Improper Privilege Management in djangorestframework-simplejwt <= 5.3.1
- Authentication bug for multi tenant django app
- missing some packages and can not import coreapi from restframeword library
- Getting a token takes nearly a second
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from djangorestframework-simplejwt.