0

Using the SOAP API, I can get a PartnerConnection to literally 100+ orgs. There is 1 org that this doesn't work for though. I use the System Administrator profile/user credentials. API Enabled is set for the profile. I am also not able to connect using Eclipse. In both cases, I get:

[LoginFault [ApiFault exceptionCode='INVALID_LOGIN' exceptionMessage='Invalid username, password, security token; or user locked out.' ]

The login history in the app does not show the failed attempt. I've tried updating the username, password and security token. It has not helped. I can use the username and password to log in through the UI.

Below is my groovy script to log in. I've cleared the credentials. This script has worked for many other orgs.

@Grab(group='com.sforce.soap', module='partner', version='36.2')
@Grab(group='com.sforce.ws', module='force-wsc', version='36.2')

import com.sforce.soap.partner.Connector
import com.sforce.soap.partner.PartnerConnection
import com.sforce.soap.partner.QueryResult
import com.sforce.soap.partner.sobject.SObject
import com.sforce.ws.bind.XMLizable
import com.sforce.ws.ConnectorConfig

class LoginTest {
    static void main(String... args) {
        ConnectorConfig config = new ConnectorConfig()
        config.setUsername('<username>')
        config.setPassword('<password>' + '<token>')
        config.setAuthEndpoint('https://login.salesforce.com/services/Soap/u/38.0')

        PartnerConnection connection = Connector.newConnection(config)
        println 'Connection created'
    }
}
0

Turns out, our corporate password manager had a typo in the username in one place. Logging in through the UI had the correct username.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.