function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jitendra singh 172jitendra singh 172 

{"error":"invalid_grant","error_description":"authentication failure"}* Connection #0 to host test.salesforce.com left intact

Problem with connecting to org using curl (Trailhead - Apex Web Services module)
I tried following the instructions given in the module (https://trailhead.salesforce.com/content/learn/modules/apex_integration_services/apex_integration_webservices). The code for connecting to the org using curl is as follows: 

curl -v https://login.salesforce.com/services/oauth2/token -d "grant_type=password" -d "client_id=<your_consumer_key>" -d "client_secret=<your_consumer_secret>" -d "username=<your_username>" -d "password=<your_password_and_security_token>" -H 'X-PrettyPrint:1'

I supplied all the credentials needed in the curl command but I keep getting this error whenever I execute the command: 

{"error":"invalid_grant","error_description":"authentication failure"}* Connection #0 to host test.salesforce.com left intact

help me plz......
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Jitendra,

I hope you are using the correct password with security token. Can you check if the connected app created is enabled to the profile which you are using. 


If this solution helps, Please mark it as best answer.

Thanks,
Suraj Tripathi 47Suraj Tripathi 47
Hi jitendra,

{"error":"invalid_grant","error_description":"authentication failure"}* Connection #0 to host test.salesforce.com left intact

This type of error is usually encountered when we enter the wrong API security token or the wrong password so please check whether you are entering the right information or not.

 
If you find your Solution then mark this as the best answer. 


Thank you!

Regards 
Suraj Tripathi
Borys SerwikBorys Serwik
This error occurs also when login.salesforce.com is used instead of test.salesforce.com for sandboxes