pythongoogle-authenticatorgoogle-2fa

Pyotp not giving the same code as Google authenticator even with URI


Hi there Stackoverflow users.

I tried using Python to use the 2FA Secret on Stripe to get the 2FA Code. But each time I try the codes are`nt the same as if I used Google authenticator. I Aleardy tried using a uri, but without any luck. I already checked Stackoverflow if maybe someone else had the same issue, I found one person who had, but his solution sadly did not work for me. I hope anyone can help me through this.

My current code:

def makeotpauth(email, secret):
    emailquoted = quote("Stripe: " + email)
    otpauth = "otpauth://totp/" + emailquoted + "?secret=" + secret + "&issuer=Stripe"
    totp = pyotp.parse_uri(otpauth)
    return totp

Solution

  • I found the solution: The Windows time was not in sync, it was running 2 Minutes late. To check this go to HERE.