• prince baby
  • NEWBIE
  • 10 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
Hello Experts,
I have registered my app. Could you please help in letting me know how to get:
1. client_id,
2. client secret, and
3. security token

I am trying to implement Oauth pragramatically so that I can use REST API.

Could you please help.

Thanks,
Rakesh

Hi All,

 

Not sure what I'm missing. I've been looking at this for a while and can't figure out what I'm doing wrong.  I'm trying to get a token that doesn't expire so that I can make calls to the REST api.  Here are some examples of my requests and responses.

 

None of these have worked.  What am I doing wrong?

 

curl -F "grant_type=password&client_id=my_remote_access_consumer_key&client_secret=my_remote_access_consumer_secret&username=dustin@example.com&password=my_password" https://na9.salesforce.com/services/oauth2/token

 

response: {"error":"unsupported_grant_type","error_description":"grant type not supported"}

 

curl -d "grant_type=password" -d "client_id=my_remote_access_consumer_key" -d "client_secret=my_remote_access_consumer_secret" -d "username=dustin@example.com" -d "password=my_password" https://na9.salesforce.com/services/oauth2/token

 

response: {"error":"invalid_grant","error_description":"authentication failure - Failed: API security token required"}

 

curl -d "grant_type=password&client_id=my_remote_access_consumer_key&client_secret=my_remote_access_consumer_secret&username=dustin@example.com&password=my_password" https://na9.salesforce.com/services/oauth2/token

 

response: {"error":"invalid_grant","error_description":"authentication failure - Failed: API security token required"}

 

Here's my attempt to use the SOAP login() method:

 

curl https://na9.salesforce.com/services/Soap/u/21.0 -H "Content-Type: text/xml; charset=UTF-8" -H "SOAPAction: login" -d @soap.txt

 

where soap.txt is:

 

<?xml version="1.0" encoding="utf-8" ?> <env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<env:Body>
<n1:login xmlns:n1="urn:partner.soap.sforce.com">
<n1:username>dustin@example.com</n1:username>
<n1:password>my_password</n1:password>
</n1:login>
</env:Body>
</env:Envelope>

 

 

 

response:

<?xml version="1.0" encoding="UTF-8"?>

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

 <soapenv:Body>

 <soapenv:Fault>

 <faultcode>soapenv:Client</faultcode>

 <faultstring>Element type &quot;env:Envelope&quot; must be followed by either attribute specifications, &quot;&gt;&quot; or &quot;/&gt;&quot;.</faultstring>

 </soapenv:Fault>

 </soapenv:Body>

</soapenv:Envelope>

 

 

I don't need to know how all of these work, just one.

 

Thanks in advance for the help.

Dustin