New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use USERNAME_FIELD instead username in generate token for user in token authentication #8839
Comments
can you share the code snippet please? |
In the AuthTokenSerializer class we have:
If you can write as below, you can have the same capabilities as I said:
Of course, some other changes are needed elsewhere, but that's the general idea. I don't know if I was able to convey my meaning or not. |
I think this is a near duplicate of #4193. My understanding was that you could pass whatever the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Imagine a situation where someone has chosen email as the USERNAME_FIELD field, with the current logic, it is only possible to create a token by sending the username, but if it is possible to create a token for the USERNAME_FIELD field, it is possible to create a token for any other USERNAME_FIELD field such as mobile number or email.
This idea is taken from the djoser package and has an interesting implementation. Also I can add this feature to drf. Is it worth the time to merge with the package?
The text was updated successfully, but these errors were encountered: