From 3c854f2ed8dc6e4868253fe1da8d479dfead6f96 Mon Sep 17 00:00:00 2001 From: hb-joel Date: Thu, 13 Mar 2025 12:12:06 -0700 Subject: [PATCH 1/2] Change token field type from CharField to TextField in AbstractRefreshToken model for improved storage capacity. --- .../0013_change_token_to_textfield.py | 19 +++++++++++++++++++ oauth2_provider/models.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 oauth2_provider/migrations/0013_change_token_to_textfield.py diff --git a/oauth2_provider/migrations/0013_change_token_to_textfield.py b/oauth2_provider/migrations/0013_change_token_to_textfield.py new file mode 100644 index 000000000..adbe78991 --- /dev/null +++ b/oauth2_provider/migrations/0013_change_token_to_textfield.py @@ -0,0 +1,19 @@ +# Generated by Django A.B.C on YYYY-MM-DD HH:MM +from django.db import migrations, models +from oauth2_provider.settings import oauth2_settings + + +class Migration(migrations.Migration): + + dependencies = [ + ('oauth2_provider', '0012_add_token_checksum'), + migrations.swappable_dependency(oauth2_settings.REFRESH_TOKEN_MODEL) + ] + + operations = [ + migrations.AlterField( + model_name='refreshtoken', + name='token', + field=models.TextField(), + ), + ] \ No newline at end of file diff --git a/oauth2_provider/models.py b/oauth2_provider/models.py index a76db37c0..844deb037 100644 --- a/oauth2_provider/models.py +++ b/oauth2_provider/models.py @@ -501,7 +501,7 @@ class AbstractRefreshToken(models.Model): user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE, related_name="%(app_label)s_%(class)s" ) - token = models.CharField(max_length=255) + token = models.TextField() application = models.ForeignKey(oauth2_settings.APPLICATION_MODEL, on_delete=models.CASCADE) access_token = models.OneToOneField( oauth2_settings.ACCESS_TOKEN_MODEL, From d5663ec8a91ffb89987c87c0ca7973c07c13a157 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 13 Mar 2025 19:17:02 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- oauth2_provider/migrations/0013_change_token_to_textfield.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oauth2_provider/migrations/0013_change_token_to_textfield.py b/oauth2_provider/migrations/0013_change_token_to_textfield.py index adbe78991..38a0ecd31 100644 --- a/oauth2_provider/migrations/0013_change_token_to_textfield.py +++ b/oauth2_provider/migrations/0013_change_token_to_textfield.py @@ -7,7 +7,7 @@ class Migration(migrations.Migration): dependencies = [ ('oauth2_provider', '0012_add_token_checksum'), - migrations.swappable_dependency(oauth2_settings.REFRESH_TOKEN_MODEL) + migrations.swappable_dependency(oauth2_settings.REFRESH_TOKEN_MODEL) ] operations = [ @@ -16,4 +16,4 @@ class Migration(migrations.Migration): name='token', field=models.TextField(), ), - ] \ No newline at end of file + ] \ No newline at end of file