Invalid totp
-
Code was working fine since last 4-5 months and suddenly started giving error of Invalid TOTP.
When I crossed check TOTP with google authenticator , it is not matching with what I am getting through totp.now().
Kindly guide.
-
@Moderator_2 getting TOTP error again. Here is the code I am running. Anything changed in the code?
from SmartApi.smartConnect import SmartConnect #or from SmartApi.smartConnect import SmartConnect import pyotp from logzero import logger with open("angelConfig.json", 'r') as f: data = json.load(f) api_key = data['api_key'] # username = data['username'] pwd = data['pwd'] clientID = data["clientID"] smartConn = SmartConnect(api_key) try: token = data['otp_token'] totp = pyotp.TOTP(token).now() except Exception as e: logger.error("Invalid Token: The provided token is not valid.") raise e data = smartConn.generateSession("clientID", "pwd", "totp") refreshToken = data['data']['refreshToken'] userProfile = smartConn.getProfile(refreshToken) payload = { "mode": "FULL", "exchangeTokens": { "NSE": ["3045"] } } MarketQuoteData = smartConn.getMarketData(payload)
-
@Moderator_1 Thanks for the response. Its working for me now.
-
@nishi21694 i am also facing same error
-
@asr-rajesh How are you calling the TOTP in your code?
@Moderator_2 has shared a method for python. Please use a similar method for your SDK. -
I am also getting the same issue. Could you please fix this ASAP ?
{
"status": false,
"message": "Invalid totp",
"errorcode": "AB1050",
"data": null
} -
Hello @iamrv9,
Please use the TOTP generate function shared by @Moderator_2 .
Let us know if you still have any issues.
Regards
SmartAPI Team -
@sen im getting the same error,have you resolved it?
-
Hi @nishi21694
Apologies for delayed response.
TOTP functionality is working fine from our end. We recommend to use the PyOtp in python SDK, Kindly reverify with the below code snippet and let us know if the issue still occurspip install pyotp
import pyotp try: token = "Your QR value" totp = pyotp.TOTP(token).now() except Exception as e: logger.error("Invalid Token: The provided token is not valid.") raise e
Thanks & Regards,
SmartAPI team -
@nishi21694 That's correct.
The code id resulting AB1050 error.
Seems like Angel Team making changes without testing them thoroughly.