Error while doing Salesforce Authentication from C# Client Application -
below complete code have written work login()
salesforce authentication. but, getting error if execute code in .net client (console application). can please suggest me how solve problem.
my onsite coordinator has confirmed fine long salesforce concerned.
code
private bool login() { string username = "kak.mca@gmail.com"; string password = "temp0r@ry"; string securitytoken = ""; string resultsessionid = string.empty; string resultserverurl = string.empty; binding = new sforceservice(); binding.timeout = 60000; loginresult lr; try { #region method1 //lr = binding.login(username, password); #endregion method1 #region method2 using(binding) { lr = binding.login(username, password); resultsessionid = lr.sessionid; resultserverurl = lr.serverurl; } #endregion method2 return true; } catch (soapexception e) { console.writeline("fault code: " + e.code + environment.newline + "error message: " + e.message + environment.newline + "stack trace:" + e.stacktrace); return false; } }
error:
<font color='red'>fault code: invalid_login<br /> error message: invalid_login: invalid username, password, security token; or user locked out.<br /> stack trace: @ system.web.services.protocols.soaphttpclientprotocol.readresponse(soapclientmessage message, webresponse response, stream responsestream, boolean asynccall) at system.web.services.protocols.soaphttpclientprotocol.invoke(string methodname, object[] parameters) at walkthrough.sforce.sforceservice.login(string username, string password) in <filepath>\web reference\sforce\reference.cs:line 545 at walkthrough.quickstartapisample.login() in <filepath>\quickstartapisample.cs:line 54 </font>
you missing security token. can 1 navigating your name > setup > personal setup > personal information > reset security token. password variable should
password = loginpassword + securitytoken;
or can try set authorization, authenticating apps oauth , digging deeper oauth 2.0 on force.com
Comments
Post a Comment