Skip to content

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

Open
@hb-joel

Description

@hb-joel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions