[SalesForce] Error logging in via API

Here is an interesting error. I'm working on an app that logs in to Salesforce using the SOAP API in .NET using SForceService. When it's run locally it logs in fine and goes about it's business.

When it's put up on another server it fails with (it takes a long time before it throws this error)

INVALID_LOGIN: Invalid username, password, security token; or user
locked out.

Try it again locally and it works fine. Credentials are all the same. I log in to the org and look at the user's login history to try and get more details – there are no records at all from the server's IP address, only the local machine.

I'm thinking it's some sort of timeout or connectivity issue since there is no login history – but why the error about credentials? Has anyone experienced this before or have any ideas what the problem might be?

Update: I installed the Force.com Explorer on the target machine and logged in using the same credentials. That worked. So the credentials are definitely good. The problem has to be in the app or perhaps have something to do with the firewall? The same compiled app still runs fine on my local machine. It just hangs at Logging in and then fails as detailed above.

UPDATE: It was a config file issue. The config file it was using when deployed didn't have a username or password set at all. I guess I would have expected a slightly different error in that case but at least it explains everything.

Best Answer

That's an explicit error returned from the server, so you request made it to a server and back. did you deploy the config file for your app (is this a desktop app or a web app?), as normally the .NET tools put the server url into the config file. Perhaps your request is going to sandbox when it should be going to production or visa versa. (typically this, or a screw up with the username is why you don't see anything in login history). Are you sending the api security token? if not, check that the new host is white listed. (although you should see a login history entry for that).

Related Topic