Closed shekar3110a closed 1 year ago
Much needed functionality. 😎
It will be better if they come up with external 2fa app. like other brokers are doing using GoogleAuthenticator
This is a workaround that I am using. Once you call client.session_2fa(otp)
a bunch of token is generated which is saved in NeoAPI.configuration
field. You can directly set those tokens from next time onwards without calling the login
function:
In this case neo_creds
contains tokens which were saved in db the first time after logging through normal process (OTP, etc.).
client = NeoAPI(access_token=neo_creds.accesstoken.strip(), consumer_key=neo_creds.consumerkey.strip(),
consumer_secret=neo_creds.consumer_secret.strip(), environment='prod', on_close=None, on_open=None)
client.configuration.view_token = neo_creds.view_token
client.configuration.edit_token = neo_creds.edit_token
client.configuration.edit_sid = neo_creds.sid
client.configuration.bearer_token = neo_creds.bearer_token
client.configuration.edit_rid = neo_creds.edit_rid
client.configuration.login_params = {'mobileNumber': neo_creds.mobile_num, 'password': neo_creds.password}
client.configuration.serverId = neo_creds.serverid
client.configuration.sid = neo_creds.sid
Thanks figured it out
where can I get sid ad server id?
This is a workaround that I am using. Once you call
client.session_2fa(otp)
a bunch of token is generated which is saved inNeoAPI.configuration
field. You can directly set those tokens from next time onwards without calling thelogin
function: In this caseneo_creds
contains tokens which were saved in db the first time after logging through normal process (OTP, etc.).client = NeoAPI(access_token=neo_creds.accesstoken.strip(), consumer_key=neo_creds.consumerkey.strip(), consumer_secret=neo_creds.consumer_secret.strip(), environment='prod', on_close=None, on_open=None) client.configuration.view_token = neo_creds.view_token client.configuration.edit_token = neo_creds.edit_token client.configuration.edit_sid = neo_creds.sid client.configuration.bearer_token = neo_creds.bearer_token client.configuration.edit_rid = neo_creds.edit_rid client.configuration.login_params = {'mobileNumber': neo_creds.mobile_num, 'password': neo_creds.password} client.configuration.serverId = neo_creds.serverid client.configuration.sid = neo_creds.sid
Can you some complete code on how to create object "neo_creds"?
This is a workaround that I am using. Once you call
client.session_2fa(otp)
a bunch of token is generated which is saved inNeoAPI.configuration
field. You can directly set those tokens from next time onwards without calling thelogin
function: In this caseneo_creds
contains tokens which were saved in db the first time after logging through normal process (OTP, etc.).client = NeoAPI(access_token=neo_creds.accesstoken.strip(), consumer_key=neo_creds.consumerkey.strip(), consumer_secret=neo_creds.consumer_secret.strip(), environment='prod', on_close=None, on_open=None) client.configuration.view_token = neo_creds.view_token client.configuration.edit_token = neo_creds.edit_token client.configuration.edit_sid = neo_creds.sid client.configuration.bearer_token = neo_creds.bearer_token client.configuration.edit_rid = neo_creds.edit_rid client.configuration.login_params = {'mobileNumber': neo_creds.mobile_num, 'password': neo_creds.password} client.configuration.serverId = neo_creds.serverid client.configuration.sid = neo_creds.sid
Can you some complete code on how to create object "neo_creds"?
store the details in a json file:
def generateAccessToken():
client = NeoAPI(consumer_key=cmn.consumer_key, consumer_secret=cmn.consumer_secret,
environment='prod')
client.login(
mobilenumber=cmn.mobile_number, password=cmn.login_password)
# Complete login and generate session token
client.session_2fa(OTP=cmn.mpin)
login_dicts = {'mobileNumber': cmn.mobile_number,
'password': cmn.login_password}
dicts = {"access_token": client.configuration.bearer_token,
"view_token": client.configuration.bearer_token,
"edit_token": client.configuration.edit_token,
"edit_sid": client.configuration.edit_sid,
"bearer_token": client.configuration.bearer_token,
"edit_rid": client.configuration.edit_rid,
"login_params": login_dicts,
"serverId": client.configuration.serverId,
"sid": client.configuration.sid
}
cmn.storeJSON(
"json_file_access_token", dicts)
Hi support
How can I avoid OTP validation every time I run the application, can we avoid this by some method with mpin , I tried all kind of login mechanism but it comes to OTP validation ..
if there is a way can you please guide on the login process without the OTP but using the mpin you did respond to me in my earlier login issues about using the mpin but not able to figure out the same
Any help in this regard would be of great help