Skip to content

use USERNAME_FIELD instead username in generate token for user in token authentication #8839

Open
@mojtabaakbari221b

Description

@mojtabaakbari221b

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions