Getting error while verifying TOTP from python code

Hi Team,

I am have just changed the pin because it might have expired but after changing the pin, TOTP verification is failing with error:

{"s": "error", "code": -1063, "otp_retries": 0, "failed_attempts": 1, "user_blocked": false, "message": "invalid totp, 4 attempts left"}

I have tried re-creating the new TOTP_KEY with new pin but still I am getting same error. Due to this I am blocked and my script is not able to proceed with further trading calls. It was working perfectly fine until yesterday.

I am using similar code as mentioned here in github and it is failing at verification call as mentioned in this code at line 55.

Hi

Use this code

https://github.com/FyersDev/fyers-api-sample-code/blob/sample_v3/v3/python/login/auto_login_totp.py

This works. Thanks @Z4PBvkQGyF !

i have used this code but getting an error

send_login_otp success

generate_totp success

verify_totp_result failure - {“s”: “error”, “code”: -1063, “otp_retries”: 0, “failed_attempts”: 1, “user_blocked”: false, “message”: “invalid totp, 4 attempts left”} pl help

@Z4PBvkQGyF - Seems this code is not avialable now, I’m getting error something like below when try to generate TOTP

OutPut:
send_login_otp msg SUCCESS
generate_totp msg failure - Non-base32 digit found

Code:


def generate_totp(secret):
    try:
        generated_totp = pyotp.TOTP(secret).now()
        return [SUCCESS, generated_totp]
    except Exception as e:
        return [ERROR, e]

generate_totp_result = generate_totp(secret=TOTP_KEY)
    if generate_totp_result[0] != SUCCESS:
        print(f"generate_totp msg failure - {generate_totp_result[1]}")
        sys.exit()
    else:
        print("generate_totp msg success")

@bishvamitra_pandey Could you please DM your details so that we can connect and help you with it