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
Format of Tokens returned now including microseconds #1395
Comments
It seems that this is an issue that's already been addressed in JWT if I read the linked issue correctly? Should just wait for a new release I think. |
This also extends to other packages/languages e.g. I am using jwt-go, and this broke one of our applications, because it was expecting a float64, not a string. This isn't just affecting the Laravel ecosystem, but other ecosystems too, who use these tokens issued by passport. Thanks for listening |
Why are you using tokens generated by passport with another oauth server? Interested in the use case here |
Good question, we have a CLI application written in Go which communicates with our PHP service (written using Laravel) and so we use the token when communicating with this service. One feature with this CLI is we show the tokens locally stored and their expiration time, which broke when I realised that "exp" was a string not a number. Hope that helps? |
Ahh I see. It looks like you've tracked down the issue and it will be resolved in an upcoming version of the JWT package lcobucci/jwt#618. Until then, I think devs will have to implement a custom override. Thanks for the explanation. |
Description:
The format of timestamps in tokens returned from passport have changed. This is due to the underlying package, lcobucci/jwt which is now including microseconds.
Before lcobucci/jwt 4.0, they looked like this:
now:
Timestamps now include microseconds and are also returned as strings.
This has a direct impact on any services using the tokens obtained from passport. E.g. validating passport tokens in another service which previously worked results in the token being deemed invalid.
For example if your other service is using something like firebase/php-jwt you will get a BeforeValidationException every time you try to verify a token since iat (1610383442.123882) is now always greater than current timestamp (1610383442).
Also, worth noting that Passport uses firebase/php-jwt for decoding Jwt Token Cookies but the rest of the time relies on lcobucci/jwt via league/oauth2-server.
I haven't tested, but I would suspect that jwt token cookies will no longer work either since firebase/php-jwt assumes timestamps are integers.
See also lcobucci/jwt#623.
Steps To Reproduce:
Create a JWT in Passport.
Decode and verify the token in another service using firebase/php-jwt.
You get a BeforeValidationException.
The text was updated successfully, but these errors were encountered: