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

The 'iat' is not refreshed in refresh() method, which cause the user will eventually kicked out though he keep refreshing token. #249

Closed
amos-yau opened this issue May 13, 2024 · 7 comments · Fixed by #256
Labels
bug Something isn't working

Comments

@amos-yau
Copy link

Subject of the issue

Please refer to the issue and comment in the origin repository here:
tymondesigns/jwt-auth#2241 (comment)

Your environment:

Q A
Bug? yes
New Feature? no
Framework Laravel
Framework version v10.48.10
Package version 2.3.0
PHP version 8.3.6

Steps to reproduce

Scenario and steps is in the above issue url.

Expected behaviour

The new token 'iat' generated by refresh() method shall be renewed as now().

Actual behaviour

The new token 'iat' generated by refresh() method now is fixed the same as old token.

@amos-yau amos-yau added the bug Something isn't working label May 13, 2024
amos-yau added a commit to amos-yau/jwt-auth that referenced this issue May 13, 2024
…d out if the token is kept refreshing until the 'exp' hit 'JWT_REFRESH_TTL'

PHP-Open-Source-Saver#249
@mfn
Copy link
Contributor

mfn commented May 13, 2024

Can you make a PR to look at?

@amos-yau
Copy link
Author

no problem, the change is easy just 2 lines of code only.

@mfn
Copy link
Contributor

mfn commented May 13, 2024

Don't forget the tests 😅

@amos-yau
Copy link
Author

amos-yau commented May 14, 2024

I'm new to Laravel so this takes me more time to write and run test, meanwhile if anyone is interested, could first can take a look to the code change here

@lsfiege
Copy link

lsfiege commented Jun 28, 2024

Hi! I'm experiencing this exact issue and the code change suggested by @amos-yau is working. Let me check if I can send a PR.

For context: To replicate this issue, I opened multiple tabs of the same application in my browser. I let the app send periodic requests (such as using setTimeout) and waited for the refresh token flow. At first, I thought that enabling the grace period would be sufficient, but it didn't work because the users were still getting kicked out, until I found this issue, implemented the change in the vendor file, and checked this works.

@Messhias
Copy link
Collaborator

I'm new to Laravel so this takes me more time to write and run test, meanwhile if anyone is interested, could first can take a look to the code change here

If you want to can open the pull request and add the tests too.

@lsfiege
Copy link

lsfiege commented Jun 28, 2024

PR opened :) #256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants