Navigation

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

    Guide to secure your SmartAPI Account with two factor authentication

    General Discussion
    0
    104
    1955
    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.
    • A
      aj_Brk @punit last edited by

      @Ashok Actually you are right it works most of the time , but for those rare instances where by the time your request went and it expired on server side , i had added retry. It happened to me once perhaps due to slow code execution or internet.

      1 Reply Last reply Reply Quote 0
      • A
        aj_Brk @gokul last edited by

        @gokul try the latest library - pip install smartapi-python --upgrade . It appears the new version is live now

        1 Reply Last reply Reply Quote 0
        • A
          aj_Brk @mudit236 last edited by

          @mudit236 @babitakundu It appears it is updated now. Please try - pip install smartapi-python --upgrade

          1 Reply Last reply Reply Quote 0
          • M
            milind017 @punit last edited by

            @Ashok Yes I have already tried with totp as string still its same
            Yes retry not needed by still to be sure.
            I have added both code to check if I am getting the same totp, which I am getting but still not able to get the success
            Is pyotp is working for you?

            A D punit 3 Replies Last reply Reply Quote 0
            • A
              admin @milind017 last edited by

              @milind017 @Ashok @gokul @Meenavenkit

              Totp changes have been deployed in the latest python release 1.3.0
              Please use the following command to upgrade to the latest python release
              pip install smartapi-python --upgrade

              S 1 Reply Last reply Reply Quote 0
              • M
                milind017 @aj_Brk last edited by

                @aj_Brk Yes retrying working correctly, but I am not able to get the session token
                Can you please share reference code

                1 Reply Last reply Reply Quote 1
                • S
                  SSumit @milind017 last edited by

                  @milind017 check value of angleOneURI, it should be like - otpauth://totp/<client id>?secret=<secrets>&issuer=angelone.in&algorithm=SHA1&digits=6&period=30

                  and there is no need for a while loop

                  M 1 Reply Last reply Reply Quote 0
                  • D
                    dakshesh @milind017 last edited by

                    @milind017 try as int(TOPT)

                    M 1 Reply Last reply Reply Quote 1
                    • M
                      milind017 @SSumit last edited by

                      @SSumit Yes its exactly same except secret key and client id

                      1 Reply Last reply Reply Quote 0
                      • M
                        milind017 @dakshesh last edited by

                        @dakshesh yes tired same results

                        punit 1 Reply Last reply Reply Quote 0
                        • M
                          msg2biswajit last edited by

                          Please update the PHP API for TOTP and share the example for PHP Smart API Because, presently this not working with PHP Smart API

                          punit M A 4 Replies Last reply Reply Quote 1
                          • punit
                            punit @msg2biswajit last edited by

                            @msg2biswajit , please PM me , I will help

                            1 Reply Last reply Reply Quote 0
                            • punit
                              punit @milind017 last edited by

                              @milind017 PM me , we can resolve it

                              1 Reply Last reply Reply Quote 0
                              • punit
                                punit @milind017 last edited by

                                @milind017 PM me, I will try to help

                                1 Reply Last reply Reply Quote 0
                                • M
                                  msg2biswajit @msg2biswajit last edited by msg2biswajit

                                  @msg2biswajit : I have updated the PHP Smart API function as follows
                                  public static function GenerateSession($clientcode, $password, $totp)

                                  and

                                  $api_parameter = ['clientcode'=>$clientcode,'password'=>$password, 'totp'=>$totp];

                                  now it's working. But, the problem is that I need to update that $totp value manually on every 30 Second, so how can I use that for continuously for whole day ? Please provide the solution

                                  1 Reply Last reply Reply Quote 0
                                  • S
                                    saimathew123 last edited by

                                    @admin
                                    i am using tradetron and i am getting this error

                                    AngelBroking get_access_token failed: AB1050 : Invalid totp

                                    could you help me

                                    1 Reply Last reply Reply Quote 0
                                    • S
                                      saimathew123 last edited by

                                      does anybody using tradetron here...?

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        dstelangre last edited by

                                        @admin what about C# SDK update ?

                                        1 Reply Last reply Reply Quote 0
                                        • V
                                          Vignesha last edited by Vignesha

                                          Looks like the automation code provided by @aj_Brk worked. Thanks for that and 1 thing I had to change the IF condition as data['status'] (to make my code simpler to read - just my choice)
                                          if data['status']: #it should be TRUE if successfully connected
                                          break

                                          Full code:

                                          obj = SmartConnect(apikey)
                                          totp = pyotp.TOTP(s='key_below_the_qr')
                                          attempts = 5
                                          while attempts > 0:
                                          data = obj.generateSession(username, pwd, totp.now())
                                          attempts = attempts-1
                                          print(totp.now()) #printed the opt just to cross check with google auth
                                          if data['status']:
                                          break
                                          time.sleep(2)`
                                          refreshToken = data['data']['refreshToken']

                                          Overall it is good @aj_Brk thanks once again.

                                          @admin thanks for the effort of making the API trading safer much appreciated and if you're working on anything new then I would suggest

                                          1. trying to fix already existing bugs like recent auto API deletion and other issues
                                          2. making documentation easier to read with all the latest updates
                                          3. Issue with this website where clicking these icons while typing doesn't have any format effect and i have to type `` for code and ** ** for bold.(Not sure if I'm doing anything wrong) f3540dc0-6469-45d1-82c5-a3a377c48c11-image.png
                                          1 Reply Last reply Reply Quote 1
                                          • V
                                            vijayyande last edited by

                                            please update C# api also its very important

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post