Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default expiry period of "Pyotp"

I'm using Pyotp for generating OTP. Default expiry of this token is 30sec. How can I change the default expiry to some 60 seconds? This is the simple code I'm using.

secret = pyotp.random_base32()
totp = pyotp.TOTP(secret)
otp = totp.now() 
like image 878
Parvathy Avatar asked Jul 02 '18 10:07

Parvathy


1 Answers

Here, give this a try, It did work for me.

totp = pyotp.TOTP(secret, interval=60)
like image 194
Vikas Periyadath Avatar answered Sep 18 '22 23:09

Vikas Periyadath