title: Twitter for iOS, oauth_nonce & sending post request?
body: <p>I'm trying to get reverse_oauth to work on an iPhone application, but I've encountered some problems regarding the POST request and what values I actually should send, so my question is two-fold.</p>
  
  <p>I'm trying to follow the guide that twitter posted here: <a href="https://dev.twitter.com/docs/ios/using-reverse-auth" rel="nofollow">https://dev.twitter.com/docs/ios/using-reverse-auth</a></p>
  
  <p>The first question regards to oauth_nonce, or rather how do I get the value to send in?
  I get that oauth_nonce is a random generated string hashed by the algorithm HMAC-SHA1, but should I generate a random string that is hashed every time I want to make a request?
  Or is it a value that should be hashed based on something?</p>
  
  <p>And my POST request currently looks like this:</p>
  
  <pre><code>NSString *twitterUrlToPing = @"https://api.twitter.com/oauth/request_token";
  
  NSURL *twitterUrl = [NSURL URLWithString:twitterUrlToPing];
  
  NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:twitterUrl];
  [req addValue:@"xxx" forHTTPHeaderField:@"oauth_consumer_key"];
  [req addValue:@"xxx" forHTTPHeaderField:@"oauth_nonce"];
  [req addValue:@"HMAC-SHA1" forHTTPHeaderField:@"oauth_signature_method"];
  [req addValue:timeStampString forHTTPHeaderField:@"oauth_timestamp"];
  [req addValue:@"1.0" forHTTPHeaderField:@"oauth_version"];
  [req addValue:@"reverse_auth" forHTTPHeaderField:@"x_auth_mode"];
  
  [req setHTTPMethod:@"POST"];
  
  NSLog(@"twitterHeaderPostvalues: %@", [req allHTTPHeaderFields]);
  
  NSURLResponse *response;
  NSError *err;
  NSData *responseData = [NSURLConnection sendSynchronousRequest:req returningResponse:&amp;response error:&amp;err];
  NSString *content = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
  
  NSLog(@"contentResponseFromTwitter: %@", content);
  </code></pre>
  
  <p>Is this the correct way to send the request, and if not how should it look like? </p>