title: Keep getting 401 unauthorized when trying to submit text tweet - signature and header is perfect
body: <p>I have no idea what's going on. I worked so hard to get the signature and header perfect. Everything is perfect. I compared it with the oauth tool here:</p>
  
  <p><a href="https://dev.twitter.com/oauth/tools/signature-generator/" rel="nofollow">https://dev.twitter.com/oauth/tools/signature-generator/</a></p>
  
  <p>However I keep getting:</p>
  
  <pre><code>status: 401
  statusText: Unauthorized
  response: {"errors":[{"code":32,"message":"Could not authenticate you."}]}
  </code></pre>
  
  <p>I read somewhere that it might be a multipart post so I need to not include the POST/query data in the signature so I tried that but I get 403:</p>
  
  <pre><code>status: 403
  statusText: Forbidden
  response: {"errors":[{"code":170,"message":"Missing required parameter: status."}]}
  </code></pre>
  
  <p>Does anyone know what can possibly be going on? <strong><em>I don't know what code to share, because everything is matching perfectly</em></strong>. I upgrade a request token to an access token with this same algorithm ( but of course in this call the oauth_token_secret is not used). I also use the same exact method to upload an gif for attachment to tweet and it works prefectly, of course though the difference here is the upload is a multipart so I have to make it not use the post data or query parameters in the signature base string.
  I amm of course generating new header per request. And my token is acccess token not request token.</p>
  
  <p>Here are the headers for the tweet:</p>
  
  <pre><code>https://api.twitter.com/1.1/statuses/update.json
  
  POST /1.1/statuses/update.json HTTP/1.1
  Host: api.twitter.com
  User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0
  Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
  Accept-Language: en-US,en;q=0.5
  Accept-Encoding: gzip, deflate, br
  Authorization: OAuth oauth_consumer_key="......", oauth_nonce="Cdo4tSOnRkOhxOAxMJWwjrnpB2qUYyjQXfnv5kes", oauth_signature="LyRDKV44MGYxCk3TNEm8lrCPUeg%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1466330342", oauth_token="15......97-ivs............rPqXxBk", oauth_version="1.0"
  Content-Length: 17
  Content-Type: text/plain;charset=UTF-8
  Cookie: ...........
  Connection: keep-alive
  status=Hellohiiii
  
  
  HTTP/2.0 401 Unauthorized
  Content-Encoding: gzip
  Content-Length: 89
  Content-Type: application/json; charset=utf-8
  Date: Sun, 19 Jun 2016 09:58:52 GMT
  Server: tsa_a
  Strict-Transport-Security: max-age=631138519
  x-connection-hash: 1db624e689db4dc937d06c68e7318aa9
  x-response-time: 6
  x-tsa-request-body-time: 1
  X-Firefox-Spdy: h2
  </code></pre>
  
  <p>Does anyone have any ideas?</p>
  
  <p>Edit:
  Because the multipart formdata submits fine, I am suspecting it is the post data I am sending. When I post the data I tried with <code>encodeURIComponent</code> and without it. Neither had affect though, still would get 401. In the signature making I used of course without any encoding.</p>