diegopolido said about 3 years ago on Two Factor Authentication :
Hey there! First of all, thanks a lot for this tutorial! I need some help:

I have an application that has a lot of instances with lot of users. Most of them got the proper process to enable 2FA. However, some of them didn't get to enable their accounts, forcing myself to allow the users to operate the system without 2FA. The problem is that Google Authenticator reads the QR Code properly but the code the user type to enable the account doesn't match and the process doesn't enable the 2FA. I did some test about to get user's codes and ran bunch of times user.otp_code to compare with user's codes:

Time  User's code   user.otp_code  
00s        542851    =>   154955
30s        154955    =>   674074
60s        674074    =>   998683
90s        998683    =>   another

Seems there's some delay between Google Authenticator and the gem. I tried to increase the drift to 120, but it didn't work. Some people are posting some comments on the gem github.

I appreciate your help!