@admin Yes I do, also verified it by printing it in console you can see below line in my code
console.log("%s", [apiKey, userId, password, totp]);
@admin Yes I do, also verified it by printing it in console you can see below line in my code
console.log("%s", [apiKey, userId, password, totp]);
@admin Yes i did checked i am passing correct 6 digit code from authenticator app and also it is matching with speakeasy's totp function response
I am also facing same issue but in nodejs
here is my code
async function login2(userId, password, totp1 = "") {
// Get API credentials for this user
const user = await userService.getUser("angelone", userId);
if (!user) {
throw new Error("User not found or not subscribed");
}
const apiKey = user["api_key"];
const apiSecret = user["api_secret"];
let { SmartAPI } = require("smartapi-javascript");
const totp = speakeasy.totp({
secret: TOTP_SECRET,
encoding: "base32",
});
console.log("%s", [apiKey, userId, password, totp]);
let smart_api = new SmartAPI({
api_key: apiKey, // PROVIDE YOUR API KEY HERE
});
// If user does not have valid access token and refresh token then use generateSession method
res = await smart_api.generateSession(userId, password, totp);
console.log(res);
return res;
}
here is response
{
status: false,
message: 'Invalid totp',
errorcode: 'AB1050',
data: null
}