We are trying to interface with our SalesForce instance via HTTP. The idea would be to call some of our custom classes from outside salesforce but without any user interaction. Typical scenario is when our ERP System calls out to SalesForce to inform it about a new customer or order.
The plan is for our ERP to call something like GET https://<our.salesforce.com>/our/res/class?param1=A¶m2=B (or POST with DATA).
I am reasonably well versed in making the actual REST classes but stumped when it comes to OAuth authentication. I take it Basic Authentication by encoding the username:password as Authorization: Basic blahblah== is out? So how to authenticate or get a Session ID?
Note, this is machine-to-machine communication with no user interaction. Yet the Remote Application setup in SalesForce requires me to enter a "Callback URL" which is described as "typically the URL that a user’s browser is redirected to after successful authentication". So what is atypical? What must I enter here?
UPDATE
Here the CURL command I am using:
curl --form client_id=***** --form client_secret=***** --form grant_type=password --form username=blah%40blah.com.sandbox --form password=passwordTOKEN -H "content-type: application/x-www-form-urlencoded" https://test.salesforce.com/services/oauth2/token Request:
POST https://test.salesforce.com/services/oauth2/token HTTP/1.1 User-Agent: curl/7.26.0 Host: test.salesforce.com Accept: */* Content-Length: 723 Expect: 100-continue content-type: application/x-www-form-urlencoded; boundary=----------------------------e3e12e44c894 ------------------------------e3e12e44c894 Content-Disposition: form-data; name="client_id" ***** ------------------------------e3e12e44c894 Content-Disposition: form-data; name="client_secret" ***** ------------------------------e3e12e44c894 Content-Disposition: form-data; name="grant_type" password ------------------------------e3e12e44c894 Content-Disposition: form-data; name="username" blah%40blah.com.dev1 ------------------------------e3e12e44c894 Content-Disposition: form-data; name="password" passwordTOKEN ------------------------------e3e12e44c894-- Response:
HTTP/1.1 400 Bad Request Date: Tue, 28 Jan 2014 13:20:53 GMT Pragma: no-cache Cache-Control: no-cache, no-store Content-Type: application/json;charset=UTF-8 Content-Length: 81 {"error_description":"grant type not supported","error":"unsupported_grant_type"} Tried using test.salesforce.com and instance.salesforce.com (which the docs use). Also tried with and without API token appended to password.
My client_id is 85 characters long.

unsupported_grant_typeis not one of the documented error codes! help.salesforce.com/apex/…test.salesforce.comas I'm in a sandbox. I've also 100% verified my credentials (username, password and token) into the same instance by using the SOAP API (test.salesforce.com/services/Soap/c/24.0)