Skip to content

Error when creating refresh token: value too long for type character varying(255) #1557

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

Open
2 tasks done
hb-joel opened this issue Mar 13, 2025 · 0 comments · May be fixed by #1558
Open
2 tasks done

Error when creating refresh token: value too long for type character varying(255) #1557

hb-joel opened this issue Mar 13, 2025 · 0 comments · May be fixed by #1558
Labels

Comments

@hb-joel
Copy link

hb-joel commented Mar 13, 2025

Describe the bug

When trying to create a new refresh token using OAuth2 in Django using custom token genretor , the application throws a django.db.utils.DataError: value too long for type character varying(255) error. This seems to be caused by attempting to insert a value that exceeds the column size in the database.

To Reproduce

  1. Call the endpoint to issue a new token with an authorization code.
  2. This should trigger the creation of a refresh token.
  3. The error value too long for type character varying(255) is thrown.

Expected behavior

The refresh token should be created successfully without the database column size being a problem.

Version

  • django-oauth-toolkit version: 3.0.1
  • I have tested with the latest published release and it's still a problem.
  • I have tested with the master branch and it's still a problem.

Additional context

  • The error occurs specifically during the creation of a refresh token in the oauth2_provider/oauth2_validators.py file.
  • It seems that the RefreshToken model might need its column size increased or additional validation added to ensure the token length fits the database constraints.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant