salesforce沙箱cURL请求无效的grant_type [英] salesforce sandbox cURL request invalid grant_type

查看:159
本文介绍了salesforce沙箱cURL请求无效的grant_type的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用cURL请求访问Salesforce沙箱帐户.我已经使用成功运行的单独的salesforce开发人员帐户创建了类似的cURL请求;但是,在修改了来自该请求的信息后,我得到一个错误:无效的grant_type响应.以下是两个请求.第一个是工作请求,第二个是具有无效的grant_type错误的沙盒帐户.

1个作品curl https://login.salesforce.com/services/oauth2/token -d grant_type=密码-d"client_id = abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuv_ab" -d"client_secret = 1234567891011121314" -d用户名=someone@email.com" -d密码=密码xxxxxxxxxxxxxxxxxx" -H"X-Prettyprint:1"

2.不起作用curl https://test.salesforce.com/services/oauth2/token -d grant_type= password -d"client_id = zxcvbnmasdfghjklqwertyuiopzxcvbnmasdfghjklqwertyuiop" -d"client_secret = 7845679304-1945678" -d"username=someone@email.com.sandbox -d" password = passwordxxxxxxxxxxxxxxx"-H:X

其中xxxxxxxx =安全令牌

这两个请求几乎相同,但是具有不同的client_id client_secret用户名和密码.它们的网址也略有不同.

我的猜测是,我必须启用/禁用沙箱帐户中的某些内容才能允许这些类型的请求.但是,我不确定,希望能帮助您确定此问题的解决方案.

当我向沙箱发出请求时,会收到以下消息

  {"error_description":不支持授权类型",错误":"unsupported_grant_type"} 

解决方案

生产组织的客户ID不能与沙箱组织一起使用,反之亦然.

因此,您需要在沙箱Org中设置一个新应用,以获取一个可以在沙箱中运行的client_id.

I am trying to access a salesforce sandbox account using a cURL request. I have created a similar cURL request using a separate salesforce developer account which has worked successfully; however, upon modifying the information from that request I get an error: invalid grant_type response. Below are the two request. The first is the working request and the second is the sandbox account which has the 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=1234567891011121314" -d "username=someone@email.com" -d "password=passwordxxxxxxxxxxxxxxxxxx" -H "X-Prettyprint:1"

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

where xxxxxxxx=security token

The two requests are almost identical but with different client_id client_secret username and password. They also have slightly different urls.

My guess is that there is something that I have to enable/disable from the sandbox account to allow these types of requests. However, I'm not sure and would appreciate help in determining a solution to this problem.

EDIT: When I make the request to the sandbox I get the follow message

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

解决方案

The client Id from a production organization won't work with a sandbox organization and vice versa.

So, you will need to setup a new app in a sandbox Org to get a client_id that will work in a sandbox.

这篇关于salesforce沙箱cURL请求无效的grant_type的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆