Skip to content

length of sqla OAuth2TokenMixin tokens defined as too small #836

@sistason

Description

@sistason

I am using Authlib (1.6.5) with Flask (3.1.2) and SQLAlchemy (2.0.43), extending the provided sqla_mixins.

When migrating to a database backend respecting the string maxlength (e.g. migrating from sqlite to postgres) I noticed that both access_token and refresh_token of authlib.integrations.sqla_oauth2.Oauth2TokenMixin (https://github.com/authlib/authlib/blob/main/authlib/integrations/sqla_oauth2/tokens_mixins.py#L51) are defined as String(255).
But my tokens are around 1000 bytes long, breaking the migration attempt.

As there is no actual maximal length for tokens (afaik), shouldn't this be of type Text()?
I can locally overwrite the token-types in my code, but wanted to report this as a problem for everyone using sqlalchemy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions