Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v9 Typing breaks existing refresh tokens #1435

Open
MartinGreen opened this issue Aug 7, 2024 · 0 comments · May be fixed by #1436
Open

v9 Typing breaks existing refresh tokens #1435

MartinGreen opened this issue Aug 7, 2024 · 0 comments · May be fixed by #1436

Comments

@MartinGreen
Copy link

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:

Message: League\OAuth2\Server\Grant\AbstractGrant::issueAccessToken(): Argument #3 ($userIdentifier) must be of type ?string, int given, called in /workspace/vendor/league/oauth2-server/src/Grant/RefreshTokenGrant.php on line 81
File: /workspace/vendor/league/oauth2-server/src/Grant/AbstractGrant.php
Line: 404
Trace: /workspace/vendor/league/oauth2-server/src/Grant/RefreshTokenGrant.php(81): League\OAuth2\Server\Grant\AbstractGrant->issueAccessToken(Object(DateInterval), Object(ClientEntity), 3, Array)
       /workspace/vendor/league/oauth2-server/src/AuthorizationServer.php(173): League\OAuth2\Server\Grant\RefreshTokenGrant->respondToAccessTokenRequest(Object(Slim\Http\ServerRequest), Object(League\OAuth2\Server\ResponseTypes\BearerTokenResponse), Object(DateInterval))
       /workspace/index.php(304): League\OAuth2\Server\AuthorizationServer->respondToAccessTokenRequest(Object(Slim\Http\ServerRequest), Object(Slim\Http\Response))

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!

@ssigwart ssigwart linked a pull request Aug 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant