Navigation

    SmartAPI Forum
    • Register
    • Login
    • Search
    • Categories
    • Popular
    • Groups
    • FAQs
    • API Docs

    Login does not seem work

    C#/.Net SDK
    0
    1
    10
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      saleem last edited by

      	public static string GetTotp(string otpKey)
      	{
      	var secretKey = tpNet.Base32Encoding.ToBytes(otpKey);
      	var totp = new Totp(secretKey);
      	//var otp = totp.ComputeTotp();
      	//return otp;
      
      	if (totp.RemainingSeconds() < 2)
      	{
      		Thread.Sleep(3);
      	}
      	return totp.ComputeTotp();
      	}
      	private void btnAngelOneLogin_Click(object sender, EventArgs e)
      	{
      		string api_key = "kpfqJYZO";
      		string Client_code = "M51790325";
      		string totp_qr_code_key = "4ELFQ5KYC4JL4VGNDIGPU49CJM";
      
      		SmartApi connect = new SmartApi(api_key);
      		string totp = GetTotp(totp_qr_code_key);
      
      		OutputBaseClass obj = new OutputBaseClass();
      		obj = connect.GenerateSession(Client_code, totp);
      
      		if (obj.status == false)
      		{
      			string http_code = obj.http_code;
      			string http_error = obj.http_error;
      
      			string msg = string.Format("Error Logging in. HTTP Code: {0}, HTTP Error: {1}", http_code, http_error);
      
      			MessageBox.Show(this, msg);
      			return;
      		}
      

      }

      How to fix this, Any help will be greatly appreciated

      1 Reply Last reply Reply Quote 0
      • First post
        Last post