-
Notifications
You must be signed in to change notification settings - Fork 837
Fix refresh token max length (occurs with Microsoft OAuth) #1601
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated by Django 5.1.2 on 2025-10-12 00:00 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("oauth2_provider", "0012_add_token_checksum"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="refreshtoken", | ||
| name="token", | ||
| field=models.CharField(max_length=8000), | ||
| ), | ||
| ] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -506,7 +506,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.CharField(max_length=8000) | ||||||
|
||||||
| token = models.CharField(max_length=8000) | |
| token = models.TextField() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration locks in the new length, but there’s no contextual hint for future maintainers about why
8000is the chosen bound (vs. using an unbounded text-like field). Consider adding a brief comment in the model (not the migration) explaining the rationale (e.g., known provider token sizes / why notTextField) so the next schema change doesn’t require re-discovering the same provider constraints.