forcedotcom / EMP-Connector

A simplified cometd connector for Enterprise Messaging Platform
BSD 3-Clause "New" or "Revised" License
185 stars 243 forks source link

Unable to login #70

Closed cbcoutinho closed 3 years ago

cbcoutinho commented 5 years ago

I'm trying to follow along with the Change Data Capture trailhead module, and unable to continue with the example using EMP-Connector/CometD based on a login error.

I can't ascertain what the problem is: a parser.faultstring of . is rather cryptic. Is there some additional info I can provide to determine the cause of the error?

After building the package, here's the invocation that I'm using that is resulting in an error:

$ java -jar target/emp-connector-0.0.1-SNAPSHOT-phat.jar myuser@email.com my-password /data/Employee__ChangeEvent
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.net.ConnectException: Unable to login: .
        at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:138)
        at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:100)
        at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:92)
        at com.salesforce.emp.connector.example.LoginExample.lambda$main$0(LoginExample.java:41)
        at com.salesforce.emp.connector.example.BearerTokenProvider.login(BearerTokenProvider.java:24)
        at com.salesforce.emp.connector.example.LoginExample.main(LoginExample.java:49)
LeandroHotmail commented 4 years ago

I've the same error:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. java.net.ConnectException: Unable to login: INVALID_LOGIN: Invalid username, password, security token; or user locked out. at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:138) at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:100) at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:92) at com.salesforce.emp.connector.example.LoginExample.lambda$main$0(LoginExample.java:41) at com.salesforce.emp.connector.example.BearerTokenProvider.login(BearerTokenProvider.java:24) at com.salesforce.emp.connector.example.LoginExample.main(LoginExample.java:49)

pepefloyd commented 4 years ago

@LeandroHotmail did you use your security token or added your IP to your whitelist?

LeandroHotmail commented 4 years ago

@pepefloyd yes, I tried booth but don't work yet. Have you any suggestion about please?

cbcoutinho commented 4 years ago

How complicated is your password? Does it contain special characters?

I was debugging this a number of months ago and discovered that this library wasn't able to properly serialize my password, which was then causing the INVALID_LOGIN error you are receiving. After changing my password to an alphanumeric string 20 chars long, I was able to connect

LeandroHotmail commented 4 years ago

@cbcoutinho great tip! Yes, my password contain special characters :( SO, I'll change now to test again, need to have exactly 20 chars or can be less? Thank you very much!

LeandroHotmail commented 4 years ago

@pepefloyd and @cbcoutinho see below, with the "simple" password it's working! leandrocarvalho~/Documents/Dev/events/EMP-Connector$java -jar target/emp-connector-0.0.1-SNAPSHOT-phat.jar leandrofcarvalho@curious-moose-7013.com simplepassword /data/EmployeeChangeEvent SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Subscribed: Subscription [/data/EmployeeChangeEvent:-2]

LeandroHotmail commented 4 years ago

Thank you @cbcoutinho 🥇

cbcoutinho commented 4 years ago

Great news!

anishsatalkar commented 4 years ago

My password contains some special characters. The sandbox account that I am using is used companywide and I cannot afford to change the password. Can somebody point me to the method which requires modification so that this issue can be fixed?

Just a note: My password does not contain any special characters mentioned here: http://xml.silmaril.ie/specials.html, so should it still be an issue?

leighghunt commented 3 years ago

For anyone else who gets here and makes the same mistake as me, ensure that you are appending the token to your password, e.g:

➜  EMP-Connector git:(master) java -jar target/emp-connector-0.0.1-SNAPSHOT-phat.jar leigh@empathetic-fox-urw561.com MY_PASSWORD /data/Employee__ChangeEvent
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.net.ConnectException: Unable to login: LOGIN_MUST_USE_SECURITY_TOKEN: Invalid username, password, security token; or user locked out. Are you at a new location? When accessing Salesforce--either via a desktop client or the API--from outside of your company’s trusted networks, you must add a security token to your password to log in. To get your new security token, log in to Salesforce. From your personal settings, enter Reset My Security Token in the Quick Find box, then select Reset My Security Token.
    at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:138)
    at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:100)
    at com.salesforce.emp.connector.LoginHelper.login(LoginHelper.java:92)
    at com.salesforce.emp.connector.example.LoginExample.lambda$main$0(LoginExample.java:48)
    at com.salesforce.emp.connector.example.BearerTokenProvider.login(BearerTokenProvider.java:24)
    at com.salesforce.emp.connector.example.LoginExample.main(LoginExample.java:56)

➜  EMP-Connector git:(master) java -jar target/emp-connector-0.0.1-SNAPSHOT-phat.jar leigh@empathetic-fox-urw561.com MY_PASSWORDMY_TOKEN /data/Employee__ChangeEvent
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Subscribed: Subscription [/data/Employee__ChangeEvent:-2]
zhiburt commented 3 years ago

Hi there just had the same issue and concatenating a security token to password helped.

For anyone else who gets here and makes the same mistake as me, ensure that you are appending the token to your password, e.g:

@leighghunt good note

@cbcoutinho do you think this issue still active, I mean as I see it probably can be closed?

cbcoutinho commented 3 years ago

I'm no longer using this tool so I'm not sure if the limitations mentioned above are still an issue. Closing it seems fine to me