Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs
    1. Home
    2. 9868072301
    3. Posts
    9
    • Profile
    • Following 0
    • Followers 0
    • Topics 0
    • Posts 3
    • Best 0
    • Groups 0

    Posts made by 9868072301

    • RE: java sdk 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]);

      posted in General Discussion
      9
      9868072301
    • RE: java sdk 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

      posted in General Discussion
      9
      9868072301
    • RE: java sdk TOTP

      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
      }

      posted in General Discussion
      9
      9868072301