Note that there are some explanatory texts on larger screens.

plurals
  1. POTwitter API & DotNetOpenAuth & HttpClient: Error "Could not authenticate you"
    primarykey
    data
    text
    <p>I'm trying to post a Twitter status update and I just can't get it working.</p> <pre><code>var consumer = new TwitterConsumer(); // WebConsumer implementation var httpClient = new HttpClient(consumer.CreateAuthorizingHandler("THE_TOKEN", new HttpClientHandler())); var content = new FormUrlEncodedContent(new Dictionary&lt;string, string&gt; { {"status", "test"} }); // yes, yes, ugly code, only testing here var s = httpClient.PostAsync("https://api.twitter.com/1.1/statuses/update.json", content); var t = s.Result; var u = t.Content.ReadAsStringAsync().Result; // HTTP 401, response from Twitter is {"errors":[{"message":"Could not authenticate you","code":32}]} </code></pre> <p>Of course, initially I thought there were some problems with my auth tokens or the OAuth process, but all other things are working fine:</p> <p>The OAuth authentication seems to work, because I can access other API methods like <code>https://api.twitter.com/1.1/account/settings.json</code>.</p> <p><strong>I can even post status updates when submitting the <code>status</code> via the URI</strong>, like <code>POST https://api.twitter.com/1.1/statuses/update.json?status=test</code>. I only get the error when I try to put the <code>status</code> in the request body.</p> <p>According to Google a lot of people have similar problems, unfortunately the suggested solutions (like double-checking the url-encoding or the <code>content</code>-Request-Header) do not work for me (the request looks as it should in Fiddler).</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload