Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    wrong totp, error code = AB1050

    Python SDK
    0
    4
    179
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • P
      piidus last edited by

      Screenshot 2022-10-12 113858.jpg

      V 1 Reply Last reply Reply Quote 0
      • V
        vardaan24 @piidus last edited by

        @piidus Facing same issue since two days.

        V 1 Reply Last reply Reply Quote 0
        • V
          vardaan24 @vardaan24 last edited by

          @vardaan24 How to enable Time-based One Time Password (TOTP) ? (one-time setup)

          Step 1 - Visit smartapi.angelbroking.com/enable-totp
          Step 2 - Enter your Angel One client id and trading terminal password
          Step 3 - Enter OTP sent to Registered email & mobile. Once OTP is entered, you will see a QR code on the screen.
          Step 4 - Open the authenticator app of your choice
          Step 5 - Scan the QR code generated from our site on your authenticator app

          How to login to SmartAPI using password and TOTP?

          Once your authenticator app scans the QR code, it will automatically generate an authentication code (called as TOTP) every 30 seconds. You are required to pass the TOTP code in our existing loginbypassword API endpoint (/rest/auth/angelbroking/user/v1/loginByPassword) by sending a new "totp" parameter via the request body.

          The below request parameters illustrates how to send the client code, password and totp to authenticate and get the tokens

          {
          "clientcode":"your_client_code",
          "password":"your_password",
          "totp":"enter_the_code_displayed_on_your_authenticator_app"
          }

          1 Reply Last reply Reply Quote 0
          • B
            B232638 last edited by

            Error:
            Order placement failed for XXXXXPE. Error: string indices must be integers
            Invalid totp, error code = AB1050

            If you are facing above mentioned errors recently, This is due to the Implementation of totp while generating session.

            The version of smartapi and websocket-client pakages should be latest. ie., smartapi-python-1.3.0 & websocket-client-1.4.1

            Uninstall the existing packages and Install the latest one.

            Uninstall

            PS C:\Users> pip uninstall smartapi-python
            Found existing installation: smartapi-python 1.2.9
            Uninstalling smartapi-python-1.2.9:

            PS C:\Users> pip uninstall websocket-client
            Found existing installation: websocket-client 1.2.1
            Uninstalling websocket-client-1.2.1:
            Successfully uninstalled websocket-client-1.2.1

            Install

            PS C:\Users> pip install smartapi-python
            Collecting smartapi-python
            Downloading smartapi-python-1.3.0.tar.gz (13 kB)
            Preparing metadata (setup.py) ... done
            Successfully built smartapi-python
            Installing collected packages: smartapi-python
            Successfully installed smartapi-python-1.3.0

            PS C:\Users> pip install websocket-client
            Collecting websocket-client
            Downloading websocket_client-1.4.1-py3-none-any.whl (55 kB)
            ---------------------------------------- 55.0/55.0 kB 2.8 MB/s eta 0:00:00
            Installing collected packages: websocket-client
            Successfully installed websocket-client-1.4.1

            Cause:

            Older version of SmartConnect only takes 3 values Including apikey

            def generateSession(self,clientCode,password):

                params={"clientcode":clientCode,"password":password}
            

            Latest Version

            def generateSession(self,clientCode,password,totp):

                params={"clientcode":clientCode,"password":password,"totp":totp}
            
            1 Reply Last reply Reply Quote 0
            • First post
              Last post