• Rajesh Purushothaman
  • NEWBIE
  • 15 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 1
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 6
    Replies
Hi,

I am trying to call the SANDBOX and I cant get my OAuth to work.
I am using Curl to make the call. 

curl -v --cacert cacert.pem POST -H --URL 'https://test.salesforce.com/services/oauth2/token' -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=password&client_id=<client_id>&client_secret=<client_secret>&username=<username>&password=<password><securitytoken>'

When I execute this command, this is the output that i am getting

* Rebuilt URL to: POST/
* Hostname was NOT found in DNS cache
* getaddrinfo(3) failed for POST:80
* Couldn't resolve host 'POST'
* Closing connection 0
curl: (6) Couldn't resolve host 'POST'
* Hostname was NOT found in DNS cache
*   Trying 136.147.58.45...
* Connected to test.salesforce.com (136.147.58.45) port 443 (#1)
* successfully set certificate verify locations:
*   CAfile: cacert.pem
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.0 / AES256-SHA
* Server certificate:
*        subject: C=US; ST=California; L=San Francisco; O=Salesforce.com, Inc; OU=Applications; CN=test.salesforce.com
*        start date: 2015-06-05 00:00:00 GMT
*        expire date: 2018-06-04 23:59:59 GMT
*        subjectAltName: test.salesforce.com matched
*        issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
*        SSL certificate verify ok.
> POST /services/oauth2/token? HTTP/1.1
> User-Agent: curl/7.37.0
> Host: test.salesforce.com
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 251
>
* upload completely sent off: 251 out of 251 bytes
< HTTP/1.1 400 Bad Request
< Date: Fri, 07 Apr 2017 19:44:31 GMT
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Content-Security-Policy: reflected-xss block;report-uri /_/ContentDomainCSPNoAuth?type=xss
< Content-Security-Policy: referrer origin-when-cross-origin
< Set-Cookie: BrowserId=_BCFUJXiSAunloQikTqmQw;Path=/;Domain=.salesforce.com;Expires=Tue, 06-Jun-2017 19:44:31 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, no-store
< X-ReadOnlyMode: false
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
<
* Connection #1 to host test.salesforce.com left intact
{"error":"invalid_grant","error_description":"authentication failure"}

This same command is working for Silverline person when he is executing from his local machine and not on Salesforce server.

Anyone knows what I should be checking for this issue?

Appreciate any help in advance.
Hi,

I am trying to call the SANDBOX and I cant get my OAuth to work.
I am using Curl to make the call. 

curl -v --cacert cacert.pem POST -H --URL 'https://test.salesforce.com/services/oauth2/token' -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=password&client_id=<client_id>&client_secret=<client_secret>&username=<username>&password=<password><securitytoken>'

When I execute this command, this is the output that i am getting

* Rebuilt URL to: POST/
* Hostname was NOT found in DNS cache
* getaddrinfo(3) failed for POST:80
* Couldn't resolve host 'POST'
* Closing connection 0
curl: (6) Couldn't resolve host 'POST'
* Hostname was NOT found in DNS cache
*   Trying 136.147.58.45...
* Connected to test.salesforce.com (136.147.58.45) port 443 (#1)
* successfully set certificate verify locations:
*   CAfile: cacert.pem
  CApath: none
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using TLSv1.0 / AES256-SHA
* Server certificate:
*        subject: C=US; ST=California; L=San Francisco; O=Salesforce.com, Inc; OU=Applications; CN=test.salesforce.com
*        start date: 2015-06-05 00:00:00 GMT
*        expire date: 2018-06-04 23:59:59 GMT
*        subjectAltName: test.salesforce.com matched
*        issuer: C=US; O=Symantec Corporation; OU=Symantec Trust Network; CN=Symantec Class 3 Secure Server CA - G4
*        SSL certificate verify ok.
> POST /services/oauth2/token? HTTP/1.1
> User-Agent: curl/7.37.0
> Host: test.salesforce.com
> Accept: */*
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 251
>
* upload completely sent off: 251 out of 251 bytes
< HTTP/1.1 400 Bad Request
< Date: Fri, 07 Apr 2017 19:44:31 GMT
< Strict-Transport-Security: max-age=31536000; includeSubDomains
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Content-Security-Policy: reflected-xss block;report-uri /_/ContentDomainCSPNoAuth?type=xss
< Content-Security-Policy: referrer origin-when-cross-origin
< Set-Cookie: BrowserId=_BCFUJXiSAunloQikTqmQw;Path=/;Domain=.salesforce.com;Expires=Tue, 06-Jun-2017 19:44:31 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Cache-Control: no-cache, no-store
< X-ReadOnlyMode: false
< Content-Type: application/json;charset=UTF-8
< Transfer-Encoding: chunked
<
* Connection #1 to host test.salesforce.com left intact
{"error":"invalid_grant","error_description":"authentication failure"}

This same command is working for Silverline person when he is executing from his local machine and not on Salesforce server.

Anyone knows what I should be checking for this issue?

Appreciate any help in advance.

I am following the guidelines from the Chatter guide and somehow I can't get the OAuth to work. 

 

It's not working from Java or curl.   Here is what I am doing:

 

mike$ curl --form client_id=3MVG9yZ.WNe6bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxu5AjB4oT9kxi8SEhY --form client_secret=26542xxxxxxxxxxx78  --form grant_type=password --form username=xxxxxxxx@gmail.com --form password=xxxxxxx https://na11.salesforce.com/services/oauth2/token

 

What I am getting is:

{"error":"invalid_grant","error_description":"authentication failure - Invalid Password"}

 

I double checked and I am getting into na11 with the right password.  Is there anything else I need to do?

 

Here are the settings in my remote access:

 



Applicationchatter



Callback URLhttps://na11.salesforce.com/ConnectTest/oauth/_callback /// temp one



No user approval required for users in this organizationNot Checked