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

When the time interval is very short,it will generate the same token in the certain condiction ? #570

Closed
garysdevil opened this issue Jan 24, 2019 · 2 comments

Comments

@garysdevil
Copy link

garysdevil commented Jan 24, 2019

Could you tell me how does it generate different token when using the same head, payload, secret but different time ?
When the time interval is less than 200ms,it may occure below.
image
Could you tell me how long the least time interval it will not occur the same token??

@garysdevil garysdevil changed the title When the time interval is very short,it will generate the same token in the certain condiction!! When the time interval is very short,it will generate the same token in the certain condiction ? Jan 24, 2019
@ziluvatar
Copy link
Contributor

By default, every second. The reason is that only the iat ("issued at" claim) would be different, it holds the time in seconds when the token was issued.

If you need to have unique tokens you could use the jwtid option with a unique identifier for each token that will set the jti claim in the token.

@panva
Copy link
Contributor

panva commented Feb 13, 2019

@garysdevil HS and RS signatures do not include any randomly generated padding, hence their signature is the same given the same payload (they are reproducible)

To get a random signature regardless of the payload you should be using ES or PS signatures.

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

No branches or pull requests

3 participants