简体   繁体   English

请求/共享返回401未经授权

[英]Request to /shares Returns 401 Unauthorized

My request to the shared file looks like this: 我对共享文件的请求如下所示:

request = (HttpWebRequest)WebRequest.Create(requestUri);
request.Method = WebRequestMethods.Http.Post;
response = request.GetResponse();

where the requestUri looks something like this: 其中requestUri看起来像这样:

https://api.dropbox.com/1/shares/auto/New%20Text%20Document.txt?
oauth_consumer_key=MY_KEY&oauth_nonce=913151&oauth_signature_method=HMAC-
SHA1&oauth_timestamp=1428055275&oauth_token=TOKEN&oauth_version=1.0&oauth_signatur
e=BLABLABLA

request.GetResponse() throws a WebException, which says: request.GetResponse()引发WebException,该异常表示:

The remote server returned an error: (401) Unauthorized . 远程服务器返回错误: (401)未经授权 And for the detailed information I receive this: Additional information: The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. 对于详细信息,我收到以下信息其他信息:基础连接已关闭:无法建立SSL / TLS安全通道的信任关系。

The flow is like this: I upload the file with the same authorization parameters successfully and then I try to retrieve the newly uploaded file's shortened URL using the call shown above but receive the exception. 流程是这样的:我成功上传的文件具有相同的授权参数,然后我尝试使用上面所示的调用来检索新上传文件的缩短的URL,但收到异常。

Please note that this worked some time ago. 请注意,这在一段时间之前有效。 Probably they've changed something in the API, but I cannot find how to do it correctly. 他们可能已经更改了API中的某些内容,但我找不到正确的方法。 So, what am I doing wrong here? 那么,我在这里做错了什么?

When I put the address into my URL it states: 当我将地址放入URL时,它会指出:

{"error": "Invalid app key (consumer key). Check your app's configuration to make sure everything is correct."}

Get a new app key and see if it then works. 获取一个新的应用程序密钥,然后查看它是否有效。

In your URL it shows oauth_consumer_key=MY_KEY I don't think so oauth_consumer_Key will generate key in that way it is just for an example. 在您的URL中,它显示oauth_consumer_key = MY_KEY我不认为,因此oauth_consumer_Key将以这种方式生成密钥,仅作为示例。

You have to login and need to follow proper steps as below to get your App key Below URL provide you all steps. 您必须登录,并且需要按照以下正确的步骤进行操作,以获取您的应用密钥。URL下面提供了所有步骤。

Steps: 脚步:

  • Login to Dropbox 登录到Dropbox
  • Click on the link “Developers” which is displayed on the bottom (center) of the page 点击页面底部(中间)显示的“开发人员”链接
  • Click on the link “My Apps” displayed in the 点击链接中显示的“我的应用”
  • menu on the left side Now click on the button “Create an App” 现在,在左侧菜单上单击“创建应用”

For more detail click here 欲了解更多详情, 请点击这里

I believe we solved this via a Dropbox support ticket. 我相信我们通过Dropbox支持票证解决了这个问题。 As far as I can tell, the issue was that a nonce was being reused. 据我所知,问题是随机数已被重用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM