RobThree / TwoFactorAuth

PHP library for Two Factor Authentication (TFA / 2FA)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Generate backup codes

pH-7 opened this issue · comments

Hi Rob! Nice work 😃

Wondering how I can generate backup codes (that are never expired).

I use ->getCode($secret); but doesn't after 30sec, 1min it doesn't work or never worked. Any idea why and how to fix it?

Thx!

You should just create X-number of random strings (or numbers) as backup code and store (salted hashes of) them somewhere safe. If the entered code doesn't match you check the input against the X hashes you stored.