[SalesForce] OAuth Password Authentication for curl

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.

Best Answer

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

-d "username=ray+1@gmail.com" needed to be -d "username=ray%2B1@gmail.com"