[GH-ISSUE #148] 2 Factor Authentication code does not match #121

Closed
opened 2026-02-25 21:34:13 +03:00 by kerem · 8 comments
Owner

Originally created by @dhuyvetter on GitHub (Nov 10, 2016).
Original GitHub issue: https://github.com/cypht-org/cypht/issues/148

Originally assigned to: @jasonmunro on GitHub.

When I enable 2 Factor Authentication and try to log in again, I keep getting the "2 factor authentication code does not match" error. The only way to log in is with one of the backup codes. I have deleted the Cypht entry in Google Authenticator and add it again, but still doesn't work.

Originally created by @dhuyvetter on GitHub (Nov 10, 2016). Original GitHub issue: https://github.com/cypht-org/cypht/issues/148 Originally assigned to: @jasonmunro on GitHub. When I enable 2 Factor Authentication and try to log in again, I keep getting the "2 factor authentication code does not match" error. The only way to log in is with one of the backup codes. I have deleted the Cypht entry in Google Authenticator and add it again, but still doesn't work.
kerem 2026-02-25 21:34:13 +03:00
  • closed this issue
  • added the
    bug
    2fa
    labels
Author
Owner

@jasonmunro commented on GitHub (Nov 10, 2016):

Hello! The likely issue here is time skew between your 2FA client and your server. When my server time is not accurate enough, 2FA stops working. You can use the ntp daemon to keep your server time accurate, or to sync it up one time the following command:

sudo ntpdate pool.ntp.org

If that doesn't help let me know and we can dig into it more. Thanks for the feedback!

<!-- gh-comment-id:259730311 --> @jasonmunro commented on GitHub (Nov 10, 2016): Hello! The likely issue here is time skew between your 2FA client and your server. When my server time is not accurate enough, 2FA stops working. You can use the ntp daemon to keep your server time accurate, or to sync it up one time the following command: `sudo ntpdate pool.ntp.org` If that doesn't help let me know and we can dig into it more. Thanks for the feedback!
Author
Owner

@ghost commented on GitHub (Nov 12, 2016):

Yeah, my Google Authenticator login keys often do not work when the time on my Android is inaccurate.

<!-- gh-comment-id:260089644 --> @ghost commented on GitHub (Nov 12, 2016): Yeah, my Google Authenticator login keys often do not work when the time on my Android is inaccurate.
Author
Owner

@jasonmunro commented on GitHub (Nov 12, 2016):

@manasb exactly. The times need to be in sync between the client and the server, since it's a part of what is used to calculate the 6 digit code.

<!-- gh-comment-id:260135581 --> @jasonmunro commented on GitHub (Nov 12, 2016): @manasb exactly. The times need to be in sync between the client and the server, since it's a part of what is used to calculate the 6 digit code.
Author
Owner

@dhuyvetter commented on GitHub (Nov 14, 2016):

Thanks @jasonmunro I re-synced the time on my server and now it is working!

<!-- gh-comment-id:260268306 --> @dhuyvetter commented on GitHub (Nov 14, 2016): Thanks @jasonmunro I re-synced the time on my server and now it is working!
Author
Owner

@dhuyvetter commented on GitHub (Mar 15, 2017):

Time kept going off, adding ntpdate pool.ntp.org to crontab didn't help, I still needed to do it manually every couple of days. So installed sudo apt install ntp: https://help.ubuntu.com/lts/serverguide/NTP.html

<!-- gh-comment-id:286650533 --> @dhuyvetter commented on GitHub (Mar 15, 2017): Time kept going off, adding `ntpdate pool.ntp.org` to `crontab` didn't help, I still needed to do it manually every couple of days. So installed `sudo apt install ntp`: https://help.ubuntu.com/lts/serverguide/NTP.html
Author
Owner

@conspacer commented on GitHub (May 8, 2017):

@jasonmunro maybe should add a small note on this in the 2fa.ini (like: "make sure your server is synced via NTP before enabling 2FA" or something to that effect).
Spent 15 minutes trying to figure out why 2FA was not working correctly until I found this thread :)

<!-- gh-comment-id:299949715 --> @conspacer commented on GitHub (May 8, 2017): @jasonmunro maybe should add a small note on this in the 2fa.ini (like: "make sure your server is synced via [NTP](http://www.ntp.org/) before enabling 2FA" or something to that effect). Spent 15 minutes trying to figure out why 2FA was not working correctly until I found this thread :)
Author
Owner

@jasonmunro commented on GitHub (May 8, 2017):

@conspacer Great idea, I just added the following:

; In order for 2fa to work, your server MUST have an accurate date and time,
; otherwise the codes won't match up. NTP is the standard way to keep a server's
; time synced: http://www.ntp.org/

<!-- gh-comment-id:299954519 --> @jasonmunro commented on GitHub (May 8, 2017): @conspacer Great idea, I just added the following: ; In order for 2fa to work, your server MUST have an accurate date and time, ; otherwise the codes won't match up. NTP is the standard way to keep a server's ; time synced: http://www.ntp.org/
Author
Owner

@jasonmunro commented on GitHub (May 10, 2017):

@conspacer I just did some testing and found that 2fa was not working for me in the current master or release branch. The passcodes were being accepted, but then when I was logged in, I lost all my previously saved settings! Not sure if ran into this, it was a bug I introduced here: github.com/jasonmunro/cypht@c55ef123f4 Anyway, it's fixed now in both the release and master branch.

<!-- gh-comment-id:300621600 --> @jasonmunro commented on GitHub (May 10, 2017): @conspacer I just did some testing and found that 2fa was not working for me in the current master or release branch. The passcodes were being accepted, but then when I was logged in, I lost all my previously saved settings! Not sure if ran into this, it was a bug I introduced here: https://github.com/jasonmunro/cypht/commit/c55ef123f4d97483c8126e01eded5c6108347f87 Anyway, it's fixed now in both the release and master branch.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/cypht#121
No description provided.