Closed tricki closed 11 months ago
8.7
PHP 8.1
I'm trying to use \Auth0\SDK\Token\Generator to generate a JWT (to return to an Action in Auth0) but kept getting this error:
\Auth0\SDK\Token\Generator
Error: The session token is invalid: Unexpected token payload type
I solved it by manually adding "typ": "JWT" to the header. The Generator class instead adds a "type": "JWT" to the header. I suspect that should be changed to "typ".
"typ": "JWT"
"type": "JWT"
Note: I'm using Auth0-PHP in a Laravel app through auth0/login, but am using Generator directly.
auth0/login
Generator
$token = \Auth0\SDK\Token\Generator::create( signingKey: 'MY_SECRET', algorithm: Token::ALGO_HS256, claims: [ // ... ], headers: ['typ' => 'JWT'], // this line makes the token valid );
Good catch; thanks for reporting this! I've created a PR fixing the issue. I'll merge and release the fix once our team has an opportunity to review the changes.
Checklist
SDK Version
8.7
PHP Version
PHP 8.1
Description
I'm trying to use
\Auth0\SDK\Token\Generator
to generate a JWT (to return to an Action in Auth0) but kept getting this error:I solved it by manually adding
"typ": "JWT"
to the header. The Generator class instead adds a"type": "JWT"
to the header. I suspect that should be changed to "typ".Note: I'm using Auth0-PHP in a Laravel app through
auth0/login
, but am usingGenerator
directly.How can we reproduce this issue?