Login does not seem work


  • 	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