Salesforce sandbox cURL request invalid grant_type

I am trying to access sandsoS salesforce account using cURL request. I created a similar cURL request using a separate Salesforce developer account, which worked successfully; however, after modifying information from this request, I get the error: Invalid grant_type response. Below are two queries. The first is a working request and the second is a sandbox account that has an invalid grant_type error.

1 WORKS curl https://login.salesforce.com/services/oauth2/token -d grant_type = password -d "client_id = abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuv_ab" -d "client_secret = 123456789d" @ username = email.com " "-d" password = passwordxxxxxxxxxxxxxxxxxx "-H" X-Prettyprint: 1 "

2. curl DOES NOT WORK https://test.salesforce.com/services/oauth2/token -d grant_type = password -d "client_id = zxcvbnmasdfghjklqwertyuiopzxcvbnmasdfghjklqwertyuiop" -d "client_secret = 7845679304" -d "client_secret = 7845679304" -19678 @ email.com.sandbox -d "password = passwordxxxxxxxxxxxxx" -H "X-Prettyprint: 1"

where xxxxxxxx = security token

The two requests are almost identical, but with different client names and passwords client_secret client_secret. They also have slightly different URLs.

I am guessing there is something I have to enable / disable from the sandbox account in order to allow these types of requests. However, I am not sure and would appreciate help in identifying a solution to this problem.

EDIT: When I make a sandbox request I get the following message

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

      

+3


source to share


1 answer


A customer ID from a production org will not work with a sandbox or vice versa.



So, you will need to set up a new application in the Org sandbox to get a client_id that will run in the sandbox.

0


source







All Articles