Too Long; Didn't Read
There are two types of OTP-based 2FA: HOTP and TOTP. HMAC-based OTP is a way of proving that a message came from the expected sender and not someone else. HOTP is calculated based on 2 values: secret key shared between client and server, counter or moving factor. Counter is an 8-byte value that is synchronized between the server and client. It will be constantly updated as you generate passwords. In HOTP, client counter is incremented each time a new password is generated and server counter is updated.