Open MartinGreen opened 3 months ago
Same problem.
TypeError: League\OAuth2\Server\Grant\AbstractGrant::issueAccessToken(): Argument #3 ($userIdentifier) must be of type ?string, int given, call
ed in /var/www/html/vendor/league/oauth2-server/src/Grant/RefreshTokenGrant.php on line 81 and defined in /var/www/html/vendor/league/oauth2-server/src/Grant/AbstractGrant.php:404
Stack trace:
#0 /var/www/html/vendor/league/oauth2-server/src/Grant/RefreshTokenGrant.php(81): League\OAuth2\Server\Grant\AbstractGrant->issueAccessToken(Object(DateInterval), Object(common\modules\oauth\models\Client),
2459525, Array)
#1 /var/www/html/vendor/league/oauth2-server/src/AuthorizationServer.php(173): League\OAuth2\Server\Grant\RefreshTokenGrant->respondToAccessTokenRequest(Object(GuzzleHttp\Psr7\ServerRequest), Object(League\
OAuth2\Server\ResponseTypes\BearerTokenResponse), Object(DateInterval))
#2 /var/www/html/common/modules/oauth/components/AuthorizationServer.php(104): League\OAuth2\Server\AuthorizationServer->respondToAccessTokenRequest(Object(GuzzleHttp\Psr7\ServerRequest), Object(GuzzleHttp\
Psr7\Response))
I have a fix in https://github.com/thephpleague/oauth2-server/pull/1436, but it hasn't been reviewed or merged. I wound up manually applying it to our codebase and it's been working great.
thank you for the fix @ssigwart - I've got one minor comment but looks great. Will aim to get this merged in asap.
I think the typing stuff in v9 has broken compatibility with my existing refresh tokens.
Ive just updated to v9 and I was able to add all the types to my classes and everything seems to be working fine. I can create new tokens via auth code or device code and via refresh. However when I try to use an existing refresh token to get a new access token it fails with the following error:
I believe this is because my userid used to be an integer. Ive changed anywhere that I pass the user id into the system to convert it to a string so its working for new stuff but existing tokens contain the id as an int. Since the refresh token is handled inside the library I dont think theres anywhere I can change my code to convert it before creating the new token.
It looks like when respondToAccessTokenRequest in RefreshTokenGrant reads the old refresh token info it would need to convert it to string before calling issueAccessToken.
Thanks.
btw. The Device Code support is great I've been waiting for that! Cheers!