Error making django-oauth-toolkit migrations with add_token_checksum

I have a Django application that has been running for quite some time and I want to update the django-oauth-toolkit library. In this case the upgrade would be from version 2.4.0 to 3.0.1. The problem is that when I run the command python manage.py migrate the field of

oauth2_provider.00XX_add_token_checksum

is never set to OK, it stays processing and never stops. What the console shows me is the following:

Operations to perform:
  Apply all migrations: admin, auth, contenttypes, oauth2_provider, sessions, users
Running migrations:
  Applying oauth2_provider.0011_refreshtoken_token_family... OK
  Applying oauth2_provider.0012_add_token_checksum...

What could it be?

According to the OP in the comments:

The solution is that the table oauth2_provider_accesstoken table has too many access_tokens stored for django to do the checksum calculation. So, the solution was to delete all the old access_tokens that are not in use and are expired

Back to Top