Guide to secure your SmartAPI Account with two factor authentication
-
@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
-
@milind017 try as int(TOPT)
-
@SSumit Yes its exactly same except secret key and client id
-
@dakshesh yes tired same results
-
Please update the PHP API for TOTP and share the example for PHP Smart API Because, presently this not working with PHP Smart API
-
@msg2biswajit , please PM me , I will help
-
@milind017 PM me , we can resolve it
-
@milind017 PM me, I will try to help
-
@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
-
@admin
i am using tradetron and i am getting this errorAngelBroking get_access_token failed: AB1050 : Invalid totp
could you help me
-
does anybody using tradetron here...?
-
@admin what about C# SDK update ?
-
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
breakFull 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
- trying to fix already existing bugs like recent auto API deletion and other issues
- making documentation easier to read with all the latest updates
- 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)
-
please update C# api also its very important
-
@priya , I have automated this process in C#
-
For Python, below code works like charm.
-
@Ashok @msg2biswajit said in Guide to secure your SmartAPI Account with two factor authentication:
Please update the PHP API for TOTP and share the example for PHP Smart API Because, presently this not working with PHP Smart API
I am sorry but modifying PHP library is not on our list. Our SDKs are all open source, and we encourage pull requests and other contributions from the community.
-
@ravindra-e TypeError: 'NoneType' object is not subscriptable error came
-
@admin Hi admin, when I try to validate totp i got below error.
refreshToken= data['data']['refreshToken']
TypeError: 'NoneType' object is not subscriptable -
@admin TOTP required only once. Thanks for keeping it simple.