Closed patidar closed 5 days ago
Thanks for the report, I'll have this fixed now
I appreciate that. If it helps I summited a pull request to fix the issue by converting the expiresIn value to a string with String(this.config.expiresIn). Thanks again 🙏
Package.json file
Node.js version
v22.11.0
Database and its version
PostgresSQL 17
Operating system name and version
Windows 11 23H2
Browser name
Chrome
What happended?
The invite JWT is not expiring after 24 hours as expected, based on the expires_at column in the table. This issue occurs because the DEFAULT_VALID_INVITE_DURATION constant is currently defined in milliseconds (60 60 24 * 1000), while the expiresIn field in the jsonwebtoken library expects a value in seconds when passed as a numeric value, or in milliseconds when passed as a string. This mismatch leads to an incorrect expiration calculation.
Steps to Reproduce:
Reference:
For more information, see the jsonwebtoken documentation on expiresIn under options at : https://github.com/auth0/node-jsonwebtoken#jwtsignpayload-secretorprivatekey-options-callback
Expected behavior
The invite JWT should expire in 24 hours after being issued.
Actual behavior
The invite JWT is not expiring after 24 hours, instead it expires in 24000 hours
Link to reproduction repo
https://github.com/medusajs/medusa.git