Open AutumnalDream opened 5 years ago
Hey, we started using this library in our project and stumbled on this same issue as well with @JoonatanPartanen.
If we understood this correctly based on few commits we found related to this, token.jti
should be a UUID
object instead of str
. Because of this we're seeing the error mentioned earlier since UUID
has a method called hex
and str
does not. We're not sure why this is happening, but we do agree that this needs a pull request. Not sure if @AutumnalDream's solution is the right one though if jti
changing from UUID
to str
is not intentional.
There is likely some migration magic going on here. Looking at the migrations preceding this one (in the same path), OutstandingToken.jti should indeed still be a UUID object instead of a str. I am not sure what actions cause the migrations to be executed out of order (or whatever causes this).
Here is a link to the file: https://github.com/SimpleJWT/django-rest-framework-simplejwt/blob/03656ce0c8e1868d742704f72e3cf17b3d5b5b33/rest_framework_simplejwt/token_blacklist/migrations/0003_auto_20171017_2007.py
There is a rejected commit that seems to try to fix this: https://github.com/SimpleJWT/django-rest-framework-simplejwt/commit/de2729431323670b6def6008e3d03aed97d07c2d#diff-0163daaef412efb1451cadacef906469
I tried the following and the migration worked:
for token in OutstandingToken.objects.all():
token.jti_hex = UUID(token.jti).hex
token.save()
When running the initial migrations for the token_blacklist app I would get this message.
So in that specific migration there is this code.
I changed it to this and now it works.