Issue with Totp


  • Hi Folk, i am a novice in coding and while trying to get login into the Angle one demat via Spyder, i am getting the below error, can anyone help me, please.
    [E 240421 17:17:50 smartConnect:243] Error occurred while making a POST request to https://apiconnect.angelbroking.com/rest/auth/angelbroking/user/v1/loginByPassword. Error: Invalid totp. URL: https://apiconnect.angelbroking.com/rest/auth/angelbroking/user/v1/loginByPassword, Headers: {'Content-type': 'application/json', 'X-ClientLocalIP': '127.0.0.1', 'X-ClientPublicIP': '106.193.147.98', 'X-MACAddress': 'cc:48:3a:66:10:f5', 'Accept': 'application/json', 'X-PrivateKey': 'key_secret[0]', 'X-UserType': 'USER', 'X-SourceID': 'WEB'}, Request: {'clientcode': 'key_secret[2]', 'password': 'key_secret[3]', 'totp': '527069'}, Response: {'status': False, 'message': 'Invalid totp', 'errorcode': 'AB1050', 'data': None}
    [E 240421 17:17:50 temp:27] {'status': False, 'message': 'Invalid totp', 'errorcode': 'AB1050', 'data': None}


  • @Satnam are you using correct to pass onto totp code. it is simple 2 lines of code to get totp. are you using barcode id in totp. it would be around 26 words like "P1234ABC...." or similar.

    import pyotp

    totp= 'P123ABC' # Replace with your actual key
    totp.now()

    you can then pass on this totp.now() in angel one to work further. this exactly what I use


  • @Satnam Same here, Response: {'status': False, 'message': 'Invalid totp', 'errorcode': 'AB1050', 'data': None}