I've seen this question on here numerous times, but none of the solutions I've found have helped.

I'm trying to authenticate via curl.

I set up a connected App, and retrieved the Client Id and Client Secret

I connected to this URL, cs25 is the node (also tried test.salesforce.com):

curl -v https://cs25.salesforce.com/services/oauth2/token -d 
"grant_type=password" -d "client_id={client id}" -d "client_secret={client 
secret}" -d "username={username}" -d "password={password}{security token}"

Obviously merging in all of the correct values for the sandbox.

The response I'm getting is

{"error":"invalid_grant","error_description":"authentication failure"}

Per another thread, I've set the App to relaxed IP usage, there's no change there.

Is there anything obvious I'm missing here? I've created a case with salesforce to help here, but I wanted to make sure there's not something I can control.

1 Answer 1


My username had a + in it, which wasn't correctly encoded.

-d "[email protected]" needed to be -d "username=ray%[email protected]"

  • 1
    I have lost hours on this and you saved me a lot more. Thank you! Jun 5, 2016 at 17:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .