title: How to wrap oAuth headers in clj-http?
body: <p>I'm trying to post a twitter status update with clojure... but this probably really is a question about oAuth headers, and using it through the wonderful <a href="https://github.com/dakrone/clj-http" rel="nofollow">clj-http</a> library.</p>
  
  <p>I've used clj-http before for basic-auth and other type of headers and it was fairly straightforward. The <code>Authorization: Bearer ...</code> was a bit confusing but I got there in the end.</p>
  
  <p>For twitter though, I am supposed to pass a lot of variables in Authorization and I am not quite sure how I'd go about doing that. Here's the curl command, according to twitter, that I'll need to post the tweet:</p>
  
  <pre><code>curl --request 'POST' 'https://api.twitter.com/1.1/statuses/update.json' 
       --data 'status=this+is+sparta' 
       --header 'Authorization: OAuth oauth_consumer_key="xxxxx",
                                oauth_nonce="xxxxx", 
                                oauth_signature="xxxxx", 
                                oauth_token="xxxxx", oauth_version="1.0"' 
       --verbose
  </code></pre>
  
  <p>So I am not sure how I would append all the <code>oAuth...</code> things in  the header. trying with <code>(str ..)</code> isn't really working out. Here's what I've got so far: </p>
  
  <pre><code>(client/post "https://api.twitter.com/1.1/statuses/update.json")
               {:headers {:Authorization (str "OAuth oauth_consumer_key='xxxxx', oauth_nonce='xxxxx', oauth_signature='xxxxx', oauth_token='xxxxx', oauth_version='1.0'" )}
                :form-params {:status "This is sparta"})
  </code></pre>
  
  <p>This returns 403. permission error when I try.</p>
  
  <p>Any ideas on how I'd construct that query? </p>
  
  <p>ps: I do have the oAuth <code>token</code> and <code>token_secret</code> for the account... but I notice the <code>token_secret</code> value isn't being passed? and what does <code>oauth_nonce</code> for? I'm for now passing the value that twitter gave me for curl... looking around it seems that it is just a random value so not that fussed about it.</p>