From 81a74de17b81241353640745e03059bf86e717bc Mon Sep 17 00:00:00 2001 From: Prashant Singh Negi Date: Thu, 24 Nov 2022 21:09:31 +0530 Subject: [PATCH] Added totp to generateSession funtion --- example/test.js | 2 +- lib/smartapi-connect.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/example/test.js b/example/test.js index c6e253f..bafb3b1 100644 --- a/example/test.js +++ b/example/test.js @@ -8,7 +8,7 @@ let smart_api = new SmartAPI({ }); // If user does not have valid access token and refresh token then use generateSession method -smart_api.generateSession("CLIENT_CODE", "PASSWORD") +smart_api.generateSession("CLIENT_CODE", "PASSWORD", "TOTP") .then((data) => { console.log(data) // return smart_api.getProfile() diff --git a/lib/smartapi-connect.js b/lib/smartapi-connect.js index 7df5cc1..6cd4c4b 100644 --- a/lib/smartapi-connect.js +++ b/lib/smartapi-connect.js @@ -145,10 +145,11 @@ var SmartApi = function (params) { * @param {string} clientcode * @param {string} password */ - self.generateSession = function (client_code, password) { + self.generateSession = function (client_code, password, totp) { let params = { "clientcode": client_code, - "password": password + "password": password, + "totp": totp } let token_data = post_request("user_login", params);