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

With the same secret Generates the same OTP code, as long as it does not expire. #50

Closed
rmatute opened this issue Nov 12, 2021 · 4 comments
Assignees
Labels
question Further information is requested

Comments

@rmatute
Copy link

rmatute commented Nov 12, 2021

Hi @BastiaanJansen

I have a question, when I send the same secret and I want to generate an OTP code again, it generates the same as long as it is valid.

Attached capture

issues-OTP-JAVA

@BastiaanJansen BastiaanJansen self-assigned this Nov 12, 2021
@BastiaanJansen BastiaanJansen added the question Further information is requested label Nov 12, 2021
@BastiaanJansen
Copy link
Owner

BastiaanJansen commented Nov 12, 2021

Hi,

This is intended behavior, with the same secret and within the same period, the generator should generate the same OTP code. Is there anything specific you are trying to accomplish?

@ghost
Copy link

ghost commented Nov 12, 2021

Hello @BastiaanJansen
How should we use the OTP generator to have different OTPs each time a new one is required, considering that each OTP that is generated must have a maximum lifetime and must be able to validate within that period.

I thought that the secret could be unique and generate different OTPs with it.

@BastiaanJansen
Copy link
Owner

Hi @gvillacis-ec ,

Whenever you need a new OTP for a different use case, you must use a different secret.

For example, if you want to send an sms with an OTP-code every time a user logs in, you use a different secret for each user so if multiple users sign in, in the same period, they all receive different OTP-codes.

@ghost
Copy link

ghost commented Nov 12, 2021

Thanks for the explanation @BastiaanJansen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants