antonioribeiro / google2fa

A One Time Password Authentication package, compatible with Google Authenticator.
MIT License
1.83k stars 199 forks source link

Get the TOTP to send through SMS #159

Closed davincileon closed 3 years ago

davincileon commented 4 years ago

Hi, the library is amazing. Is there some way, in case of the user doesn't have any authenticator app, to generate a valid TOPT to be sent via SMS ? thanks in advance.

antonioribeiro commented 3 years ago

You can probably use the $google2fa->getCurrentOtp($secret) method to get the current OTP (one time password), but it lives only 30 seconds, so you better increase your window or your users will never have enough time to receive and type it.