title: Twitter Authentication in R
body: <p>Trying to get Twitter authentication to work in R (for analyzing tweets), but RStudio does not respond to the PIN + get error messages.</p>
  
  <p>I use Mac OS X 10.6.8 and RStudio Version 0.98.1091</p>
  
  <p>Here's the code I'm using (incl. placeholders):</p>
  
  <pre><code>install.packages("twitteR")
  library(twitteR)
  download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="my_folder/my_subfolder/http://curl.haxx.se/ca/cacert.pem")
  
  
  require(twitteR)
  download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
  requestURL &lt;- "https://api.twitter.com/oauth/request_token"
  accessURL = "https://api.twitter.com/oauth/access_token"
  authURL = "https://api.twitter.com/oauth/authorize"
  consumerKey = "xxxx"
  consumerSecret = "yyyyy"
  Cred &lt;- OAuthFactory$new(consumerKey=consumerKey,
                       consumerSecret=consumerSecret,
                       requestURL=requestURL,
                       accessURL=accessURL, 
                       authURL=authURL)
  Cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl") )
  </code></pre>
  
  <p>I get this:
  "To enable the connection, please direct your web browser to: 
  <a href="https://api.twitter.com/oauth/authorize?oauth_token=bWNevwJNJUPEzKLJwHQsK2uRLN4At5LO" rel="nofollow">https://api.twitter.com/oauth/authorize?oauth_token=bWNevwJNJUPEzKLJwHQsK2uRLN4At5LO</a>
  When complete, record the PIN given to you and provide it here: registerTwitterOAuth(Cred)
  Error: Authorization Required"</p>
  
  <p>When I enter the PIN in the console I only get this:</p>
  
  <pre><code>&gt;1234567
  
  [1] 1234567
  </code></pre>
  
  <p>I then try to run 
      registerTwitterOAuth(Cred), but get this in the console:</p>
  
  <pre><code>Error in registerTwitterOAuth(Cred) : 
    oauth has not completed its handshake
  </code></pre>
  
  <p>Not sure what I am doing wrong or how I can obtain authentication/authorization.</p>
  
  <p>Very thankful for any help on this.</p>