-
Notifications
You must be signed in to change notification settings - Fork 85
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
Tenant token generated by meilisearch js expires too long. #1495
Comments
Hey @tnamao |
@tnamao based on the meili docs, it needs unix epoch time. The code on line 115 of token.ts uses getTime which return unix epoch time as expected: Date..prototype.getTime MDN Docs |
Hey @qmakani, I looked around but indeed, the official definition of an unix timestamp is in seconds. Though it may sometimes be stored in different formats, see Wikipedia:
@tnamao What are the consequences of providing the timestamp in milliseconds? Is meilisearch considering the expiring date to be in the year I don't mind fixing the timestamp to be in seconds, but I'm just wondering what issue the milliseconds are raising. |
@bidoubiwa
Multiplying the difference between the |
Description
Currently, the tenant token generated by the Go program has been changed to be generated by meilisearch js.
When the expiration date is fixed and the expiration date set for the claim in Go and JS is compared
I found that Go is set to unixtime and JS is set to millisec.
Is
exp: expiresAt?.getTime()
in this function missing conversion to unixtime?https://github.com/meilisearch/meilisearch-js/blob/main/src/token.ts#L97-L119
The meilisearch's documentation also seems to convert
Date.now()
values to unixtime.https://www.meilisearch.com/docs/learn/security/tenant_tokens#generating-a-tenant-token-with-a-third-party-library
Expected behavior
Tenant token's exp is set unixtime.
Current behavior
Tenant token's exp is set millisec.
Regards,
The text was updated successfully, but these errors were encountered: