Skip to content

OAuth Token Length Exceeds Database Column Limit #2770

@mbarram

Description

@mbarram

Description

I'm experiencing a database error when using OAuth authentication with Twill. The OAuth tokens being generated are longer than the current 255-character limit set for the token column in the twill_users_oauth table, causing SQL errors during token storage.

The error occurs when attempting to store OAuth tokens that exceed the VARCHAR(255) limit defined in the migration file.

Steps to reproduce

  1. Enable OAuth authentication in Twill configuration (twill.enabled.users-oauth = true)
  2. Set up OAuth provider (the specific provider may vary, but tokens can be lengthy)
  3. Attempt to authenticate via OAuth
  4. The authentication process fails when trying to store the token in the database

Expected result

OAuth tokens should be successfully stored in the database regardless of their length, allowing users to authenticate properly through OAuth providers.

Actual result

The following SQL error is thrown:

Error 500 SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'token' at row 1 
(Connection: mysql, SQL: update `twill_users_oauth` set `token` = 
ya29.A0EXAMPLE_TOKEN_HERE_THAT_IS_VERY_LONG_AND_EXCEEDS_255_CHARACTERS_LIMIT_ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890, 
`twill_users_oauth`.`updated_at` = 2025-06-24 16:24:58 where `id` = 3)

Versions

  • Twill version: 3.1.0
  • Laravel version: 10.39.0
  • Database engine: MariaDB

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions