<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: REST C# 401/403 Error. Problem Retrieving share link in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/REST-C-401-403-Error-Problem-Retrieving-share-link/m-p/77808#M2339</link>
    <description>&lt;P&gt;I ended up using another API using Oauth2 and it all worked. SharpBox is not updated for long time so I preferred to use a different one.&lt;/P&gt;

&lt;P&gt;Thanks for your reply Greg.&lt;/P&gt;</description>
    <pubDate>Sun, 28 Jun 2015 11:47:22 GMT</pubDate>
    <dc:creator>Demerson H.</dc:creator>
    <dc:date>2015-06-28T11:47:22Z</dc:date>
    <item>
      <title>REST C# 401/403 Error. Problem Retrieving share link</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/REST-C-401-403-Error-Problem-Retrieving-share-link/m-p/77806#M2337</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am trying to use REST to retrieve a file sharing link but I am receiving either error 401 or 403. The error I receive varies according to the tests that I try to run lol.&lt;/P&gt;

&lt;P&gt;I have the following method:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;static string HttpPost(string url, string[] paramName, string[] paramVal)
    {
        var req = WebRequest.Create(new Uri(url))
                             as HttpWebRequest;
        req.Method = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        req.Accept = "*/*";

        // Build a string with all the params, properly encoded.
        // We assume that the arrays paramName and paramVal are
        // of equal length:
        var paramz = new StringBuilder();

        for (int i = 0; i &amp;lt; paramName.Length; i++)
        {
            paramz.Append(paramName[i]);
            paramz.Append("=");
            paramz.Append(HttpUtility.UrlEncode(paramVal[i]));
            paramz.Append("&amp;amp;");
        }

        // Encode the parameters as form data:
        byte[] formData =
            UTF8Encoding.UTF8.GetBytes(paramz.ToString());
        req.ContentLength = formData.Length;

        // Send the request:
        using (var post = req.GetRequestStream())
        {
            post.Write(formData, 0, formData.Length);
        }

        // Pick up the response:
        string result = null;
        using (var resp = req.GetResponse()
                                      as HttpWebResponse)
        {
            var reader =
                new StreamReader(resp.GetResponseStream());
            result = reader.ReadToEnd();
        }

        return result;
    }
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I pass as parameter the following:&lt;BR /&gt;
url: &lt;A href="https://api.dropbox.com/1/shares/auto/path" rel="nofollow noreferrer" target="_blank"&gt;https://api.dropbox.com/1/shares/auto/path&lt;/A&gt;&lt;BR /&gt;
parameters&lt;BR /&gt;
values&lt;/P&gt;

&lt;P&gt;In my first try, I have tried passing as parameters as parameter the following:&lt;BR /&gt;
oauth_consumer_key, oauth_nonce, oauth_signature_method, oauth_timestamp, oauth_token, oauth_version, oauth_signature&lt;/P&gt;

&lt;P&gt;As a result, I have received Error 403 Forbidden. so I assumed I was receiving this error because of authentication which is funny because I am passing through the parameters, so then I did the following:&lt;/P&gt;

&lt;P&gt;included those parameters after the url just like the example below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;https://api-content.dropbox.com/1/shares/auto/PATH?oauth_consumer_key=XXX&amp;amp;oauth_nonce=XXX&amp;amp;oauth_signature_method=HMAC-SHA1&amp;amp;oauth_timestamp=1434773930&amp;amp;oauth_token=XXX&amp;amp;oauth_version=1.0&amp;amp;oauth_signature=XXX 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As a result I have received error 401 Unauthorized.&lt;/P&gt;

&lt;P&gt;I am obtaining file URI through SharpBox, using the following:&lt;BR /&gt;
&lt;CODE&gt;var uri = dropBoxStorage.GetFileSystemObjectUrl(file.Name, folder);&lt;/CODE&gt;&lt;BR /&gt;
Would anyone know why I am not able to retrieve that sharing link? &lt;/P&gt;</description>
      <pubDate>Wed, 29 May 2019 09:41:57 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/REST-C-401-403-Error-Problem-Retrieving-share-link/m-p/77806#M2337</guid>
      <dc:creator>Demerson H.</dc:creator>
      <dc:date>2019-05-29T09:41:57Z</dc:date>
    </item>
    <item>
      <title>Re: REST C# 401/403 Error. Problem Retrieving share link</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/REST-C-401-403-Error-Problem-Retrieving-share-link/m-p/77807#M2338</link>
      <description>&lt;P&gt;You're using OAuth 1 with HMAC-SHA1 signing, which is prone to issues like this. We highly recommend using PLAINTEXT signing instead, as it's much easier to implement and debug:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://blogs.dropbox.com/developers/2012/07/using-oauth-1-0-with-the-plaintext-signature-method/" rel="nofollow noreferrer"&gt;https://blogs.dropbox.com/developers/2012/07/using-oauth-1-0-with-the-plaintext-signature-method/&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Try that and let us know if that doesn't help. &lt;/P&gt;

&lt;P&gt;(Or, you can use OAuth 2: &lt;A href="https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/" rel="nofollow noreferrer"&gt;https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/&lt;/A&gt; )&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2015 12:39:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/REST-C-401-403-Error-Problem-Retrieving-share-link/m-p/77807#M2338</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2015-06-20T12:39:26Z</dc:date>
    </item>
    <item>
      <title>Re: REST C# 401/403 Error. Problem Retrieving share link</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/REST-C-401-403-Error-Problem-Retrieving-share-link/m-p/77808#M2339</link>
      <description>&lt;P&gt;I ended up using another API using Oauth2 and it all worked. SharpBox is not updated for long time so I preferred to use a different one.&lt;/P&gt;

&lt;P&gt;Thanks for your reply Greg.&lt;/P&gt;</description>
      <pubDate>Sun, 28 Jun 2015 11:47:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/REST-C-401-403-Error-Problem-Retrieving-share-link/m-p/77808#M2339</guid>
      <dc:creator>Demerson H.</dc:creator>
      <dc:date>2015-06-28T11:47:22Z</dc:date>
    </item>
  </channel>
</rss>

