Basically.. this is the same issue in the d8 module

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Zekvyrin created an issue. See original summary.

Zekvyrin’s picture

Status: Active » Needs review
FileSize
710 bytes

And this how to solve it, based on the previous commit (D7).

Zekvyrin’s picture

I have to say that I'm not 100% sure this is correct.. the token signature returned is Invalid :/

sanduhrs’s picture

Version: 8.x-1.x-dev » 2.0.x-dev
Status: Needs review » Needs work

Did you manage to make this work?

  • sanduhrs committed 69e0c46 on 2.0.x authored by Zekvyrin
    Issue #2928943 by Zekvyrin, sanduhrs: Token endpoint gives error when...
sanduhrs’s picture

sanduhrs’s picture

Status: Needs work » Fixed

  • sanduhrs committed b737948 on 2.0.x
    Revert "Issue #2928943 by Zekvyrin, sanduhrs: Token endpoint gives error...
sanduhrs’s picture

Status: Fixed » Needs work

This needs a bit more thought.

terkaa’s picture

Hi,

I get the same with Apache 2.4.53 when "JWT Access tokens" are enabled in server settings. Running Drupal 9.3.7 with Oauth2 Server 2.0.0-beta. Anything I could do to help resolving this issue?

Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'token' at row 1: INSERT INTO "oauth2_server_token" ("client_id", "uid", "type", "token", "expires", "last_access") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array\n(\n [:db_insert_placeholder_0] => apache\n [:db_insert_placeholder_1] => 6\n [:db_insert_placeholder_2] => access\n [:db_insert_placeholder_3] => eyJ0eXAiOiJKV1QiLCJhbGciOiJ.....4OhYcg\n [:db_insert_placeholder_4] => 1647763676\n [:db_insert_placeholder_5] => \n)\n" at /var/www/html/drupal/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php line 811

Nate Covington’s picture

I was able to work around this error:

Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'token' at row 1: INSERT INTO "oauth2_server_token" ("client_id", "uid", "type", "token", 

By modifying the oaht2_server_token table - change the "token" column to type=text
That'll allow for a longer token value and not throw the exception

However, I'm still getting this error after fixing it:
bad_signature
invalid_token

Any help would be appreciated

GaëlG’s picture

The change proposed in #2 still is in the Drupal 7 version of the module. I don't get why it shouldn't be in the D8+ one. The problem encountered in #3 may have another cause.