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.
    • D
      Durai @admin last edited by

      @admin not open link

      1 Reply Last reply Reply Quote 1
      • A
        anil_patel @labeebta last edited by

        @labeebta what should be the Secret Key to Generate TOTP?

        1 Reply Last reply Reply Quote 0
        • L
          luckymonu007 @admin last edited by

          @admin It already 13:00 and the link still does not work. How can I access the API ?

          1 Reply Last reply Reply Quote 0
          • M
            Meenavenkit last edited by

            The link http://smartapi.angelbroking.com/enable-totp is not working @admin @administrators . Please help. already last 2 days your APIs never worked with all changes you did without proper testing.

            Resolve this please.

            A 1 Reply Last reply Reply Quote 0
            • A
              admin @Meenavenkit last edited by

              @anil_patel @gautamnaik1994 @ivar @sachinchauhan @priya @labeebta @sachinsrm @Durai @luckymonu007 @Meenavenkit

              https://smartapi.angelbroking.com/enable-totp is live now

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

                @admin The site is working but OTP is not working or sent to the email.

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

                  Hi folks

                  If anyone looking for automating totp part , you can use the following python sample for the same. The secret here comes after validating on enable-totp url .

                  from smartapi import SmartConnect # or from smartapi.smartConnect import SmartConnect
                  import pyotp

                  import smartapi.smartExceptions(for smartExceptions)

                  create object of call

                  obj = SmartConnect(api_key="your api key here ")

                  login api call

                  totp = pyotp.TOTP(s='secret key in qr uri after qr generation')

                  attempts = 5

                  while attempts > 0:
                  attempts = attempts-1
                  data = obj.generateSession("Your client id ", "your password ", totp.now())
                  if not data['message'].contains('Invalid totp'):
                  break
                  time.sleep(2) ###rate limiting might block if we try immediately

                  refreshToken = data['data']['refreshToken']

                  A B M W G 5 Replies Last reply Reply Quote 0
                  • A
                    aj_Brk @gautamnaik1994 last edited by

                    @gautamnaik1994 I have provided a sample code below. You can give it a shot. Worked for me .

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

                      @admin @aj_Brk can you tell me how to Create a Secret Key Based on the User ID & Pass of the User?

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

                        @anil_patel I generated it here - http://smartapi.angelbroking.com/enable-totp . It is printed below QR code

                        A P 2 Replies Last reply Reply Quote 0
                        • A
                          anil_patel @aj_Brk last edited by

                          @admin @aj_Brk Thank you but I want the user to Login without Generating TOTP. so users only add their User ID & Pass and based on that Python will generate the Secret Key to generate TOTP.

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            admin @ivar last edited by admin

                            @ivar
                            You are not required to pass the TOTP with every order. It needs to be passed only with LoginbyPassword API call to generate the session and fetch the jwtToken, refreshToken and feedToken. These tokens are valid till 5 am of the subsequent day.

                            A I 2 Replies Last reply Reply Quote 0
                            • R
                              ravitandur last edited by

                              @admin said in Guide to secure your SmartAPI Account with two factor authentication:

                              https://apiconnect.angelbroking.com/rest/auth/angelbroking/user/v1/loginByPassword
                              Is this API is working?
                              When I am trying to use POST method with the above URL and sending the data, getting 415 error.

                              punit 1 Reply Last reply Reply Quote 0
                              • N
                                nitish.bane @aj_Brk last edited by nitish.bane

                                @aj_Brk How can I automate this through node js. How can i generate the secret required to generate totp

                                1 Reply Last reply Reply Quote 0
                                • B
                                  babitakundu @aj_Brk last edited by

                                  @aj_Brk obj.generateSession() is throwing an error.

                                  TypeError: generateSession() takes 3 positional arguments but 4 were given.

                                  Are you getting the same?

                                  A M 2 Replies Last reply Reply Quote 0
                                  • I
                                    imakr @labeebta last edited by

                                    @labeebta How to do it in python automatically? can you please brief , sorry im new to python

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

                                      @aj_Brk after generating this at code scan it with Google authenticator app. Then in authenticator app there will be OTP changing every minutes. While login put this current OTP . And it's done.

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

                                        @babitakundu are you providing 4 fields. It only needs 3. I didnt face this exception.

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

                                          @imakr shared the code in the forum. Uses pyotp library

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

                                            @anil_patel i don't think that is possible as the secret is generated by angel servers, logic of which is not shared. We can't do this without secret shared by them.

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