This repository was archived by the owner on Apr 25, 2021. It is now read-only.
This repository was archived by the owner on Apr 25, 2021. It is now read-only.
JWT always created with user.username and not with USERNAME_FIELD #8
Open
Description
I ran into an issue where the login_required decorator was always saying that the user was not logged in. After some debugging I realized that it was because I had changed my user model to use email as the USERNAME_FIELD rather than username.
My username was always set to null, so when the JWT was created on this line:
the token created didn't have a user identifier in it.
I was able to get around that by adding this to my user model.
@property
def username(self):
return self.email
Would be great if we could tell the library if we aren't using "username". Or if it could just use the USERNAME_FIELD from the user model.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels