英文:
Request for Request Token from Intuit IPP gives permission denied
问题
我在本地开发站点上进行这个操作没有问题。但是当我尝试从我的线上站点设置到QuickBooks文件的新连接时,我遇到了权限被拒绝的错误。
以下是返回的错误信息:"Post https://oauth.intuit.com/oauth/v1/get_request_token: permission denied"
以下是请求头部信息:
Content-Type
application/x-www-form-urlencoded
Authorization
OAuth oauth_consumer_key="MY_KEY",
oauth_nonce="MY_NONCE",
oauth_signature="MY_SIG",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1377287041",
oauth_version="1.0"
以下是请求体信息:
oauth_callback=http%3A%2F%2Fwww.intheloop-notes.com%2Fqb%2Fconnect%2Freturn%2F
---- 编辑 ----
响应完全为空,我在我的Go代码中遇到了错误:
response, err := client.Do(request)
这就是为什么我在这个问题中添加了一些标签(go和google-app-engine),以尝试扩大我的受众。我相当确定错误出现在我的OAuth库发送请求的方式上。我正在使用这个库:https://github.com/kurrik/oauth1a,在我的本地开发站点上工作得很好,但是当我从线上站点发起调用时,它给我返回了"permission denied"错误。我认为开发应用引擎服务器创建请求的方式与线上引擎的方式有所不同,但我不确定具体是什么不同。
有什么想法吗?
英文:
I am doing this on my local development site without problems. But when I try to setup a new connection to a QuickBooks file from my live site, I get a permission denied error.
Here is the error returned: "Post https://oauth.intuit.com/oauth/v1/get_request_token: permission denied"
Here are the request headers
Content-Type
application/x-www-form-urlencoded
Authorization
OAuth oauth_consumer_key="MY_KEY",
oauth_nonce="MY_NONCE",
oauth_signature="MY_SIG",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="1377287041",
oauth_version="1.0"
Here is the request body:
oauth_callback=http%3A%2F%2Fwww.intheloop-notes.com%2Fqb%2Fconnect%2Freturn%2F
---- EDIT ----
The response is nil altogether, I am getting an error from my Go code on:
response, err := client.Do(request)
Which is why I have added a couple of tags to this question (go and google-app-engine) to try and broaden my audience. I am pretty sure that the error is in the way that my OAuth library is sending the request. I am using this library: https://github.com/kurrik/oauth1a, which has been working just fine on my local development site, but gives me the "permission denied" error when I make the call from my live site. I think there is some difference in the way that the development app engine server creates the request from the way the live engine does, but I am not sure exactly what.
Any ideas?
答案1
得分: 2
我明白了!我找到解决办法了!非常感谢,Manas,如果没有你给的最后一个链接,我就找不到这个解决办法。对于那些好奇的人:我必须使用appengine.urlfetch库创建一个自定义的http.Client。一旦我弄清楚了这一点,解决方案就很简单了,我只需要将创建客户端的一行代码改成这样:
client := urlfetch.Client(appengine.NewContext(r))
问题解决了!
英文:
Eureka! I figured it out! And thank you, Manas, I would not have found this solution without that last link you gave. For anyone who is wondering: I had to create a custom http.Client using the appengine.urlfetch library. Once I figured that out, the solution was simple, I just had to change one line of code that created the client into this:
client := urlfetch.Client(appengine.NewContext(r))
Problem solved!
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论