Skip to content
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

get_or_create returns an AuthToken with token_key, digest, salt = '' when creating the first instance of AuthToken. #195

Open
SagarKishore-PFM opened this issue Oct 22, 2019 · 0 comments
Labels

Comments

@SagarKishore-PFM
Copy link

SagarKishore-PFM commented Oct 22, 2019

Steps to reproduce: (in django shell)

user = YourCustomUser.objects.get(username='your_username')
AuthToken.objects.all().delete()
token, created = AuthToken.objects.get_or_create(user=user)
token.token_key

Here the token will have empty strings for token_key, digest and salt fields when the AuthToken is created for that specific user for the first time. When you run the get_or_create command again, it returns the created Token without issues.

Of course, get_or_create throws error when multiple tokens exist for the User. Which is expected behaviour.

Also, in the admin interface, I cannot delete this bugged out token. Although I can use token.delete() in my Django shell.

Screenshot 2019-10-22 at 12 51 40 PM

@johnraz johnraz added the bug label Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants