Find your content:

Search form

You are here

Error logging in via API

 
Share

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.


Attribution to: Ryan Elkins

Possible Suggestion/Solution #1

Try regenerating the security token?


Attribution to: jordan.baucke

Possible Suggestion/Solution #2

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).


Attribution to: superfell

Possible Suggestion/Solution #3

The only thing that jumps to mind not mentioned already is concurrency - are other apps logging in as this user at the same time? I'm not sure what the limit is there.


Attribution to: joshbirk

Possible Suggestion/Solution #4

Does the server's firewall allow your app? Assuming you are connecting to the correct instance, with proper credentials, it sounds like the traffic isn't making it to Salesforce. Have you tried watching the traffic with Wireshark or another similar tool?


Attribution to: Mike Chale

Possible Suggestion/Solution #5

Could you try using the problem credentials from another tool on the server that is throwing the error?

You could use:

  • The Data Loader
  • Force.com Explorer
  • Apex Explorer. While it has been replaced by the Force.com Explorer it was a .NET application. It could be hard to download now and the link appears to redirect to the newer tool.
  • FuseIT SFDC Explorer - This is a shameless plug, but it is free, .NET based, and it does work with the SForceService created from the Partner API internally.

The idea is to try and separate out if the issue is with the server, the credentials, or the .NET code/configuration.


Attribution to: Daniel Ballinger
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/879

My Block Status

My Block Content