0
votes

I need salesforce login in dotnet without using security token (soap api).

Currently we are using login code (soap api):

SforceService mySalesForceSerice= new SforceService();  
LoginResult myLoginResult=mySalesForceSerice.login(username,String.Concat(password,***securityToken***));                
this.SessionID = myLoginResult.sessionId;
this.ServerUrl = myLoginResult.serverUrl;  

but I excepted without using security token

2

2 Answers

2
votes

Go to setup->Security Controls->Network and enter the IP address or address range of your server. Login attempts from white-listed IP addresses do not require a security token.

I do this with most of my servers so I needn't enter a token when deploying from Eclipse. I also do this so my curl scripts using apex REST services are tokenless.

1
votes

If you look at the API reference for Login

Salesforce checks the IP address from which the client application is logging in, and blocks logins from unknown IP addresses. For a blocked login via the API, Salesforce returns a login fault. Then, the user must add their security token to the end of their password in order to log in. A security token is an automatically-generated key from Salesforce. For example, if a user's password is mypassword, and their security token is XXXXXXXXXX, then the user must enter mypasswordXXXXXXXXXX to log in. ..... . When the security token is invalid, the user must repeat the login process to log in. To avoid this, the administrator can make sure the client's IP address is added to the organization's list of trusted IP addresses. For more information, see Security Token.

Following the link indicates:

If Single Sign-On (SSO) is enabled for your organization, users who access the API or a desktop client cannot log in to Salesforce unless their IP address is included on your organization's list of trusted IP addresses or on their profile, if their profile has IP address restrictions set. Furthermore, the delegated authentication authority usually handles login lockout policies for users with the “Uses Single Sign-On” permission. However, if the security token is enabled for your organization, then your organization's login lockout settings determine the number of times a user can attempt to log in with an invalid security token before being locked out of Salesforce.

It seems to me that this is a security setting that needs to be set by your salesforce administrators, and cannot be bypassed.