2

I’m trying to use the twitteR package as I’ve gotten to the Twitter chapter in Jeffrey Stanton’s free e-book on Data science.

I use this code to register my credentials:

requestURL <-  "https://api.twitter.com/oauth/request_token"
accessURL =    "https://api.twitter.com/oauth/access_token"
authURL =      "https://api.twitter.com/oauth/authorize"
consumerKey =   "------------"
consumerSecret = "-----------"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                         consumerSecret=consumerSecret,
                         requestURL=requestURL,
                         accessURL=accessURL,
                         authURL=authURL)
download.file(url="http://curl.haxx.se/ca/cacert.pem",
          destfile="cacert.pem")
twitCred$handshake(cainfo="cacert.pem")

I then get the link to twitter:

To enable the connection, please direct your web browser to: https://api.twitter.com/oauth/authorize?oauth_token=xxxx

I follow the link and within the twitter page, and then click on the “Authorize app” button. This sends me back to the site I listed as the callback URL.

I don’t see the PIN number I was expecting anywhere. My question is: where does it appear? Or where should I be looking for it? I feel like this should be obvious, but somehow I'm missing it.

Phil A
  • 51
  • 2
  • 6
  • 1
    Try editing your URLs to `http://` not `https://`. Can you let me know if it makes a difference – Simon O'Hanlon Apr 16 '13 at 17:56
  • That did it! Thank you so much, this has been driving me bananas! The examples I've seen in a couple of other places had the https, but now that I look at the example from the vingnette in r-project again I see that it has http. You've made my day! – Phil A Apr 16 '13 at 18:23
  • Maybe I wrote too soon. I got the pin and entered it in R. I then tried this code:tweetList <- searchTwitter ("#health", n=100) and got this error:Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) : OAuth authentication is required with Twitter's API v1.1 – Phil A Apr 16 '13 at 18:30
  • 1
    Immediately after the registration did you do `registerTwitterOAuth(twitCred)`? – Simon O'Hanlon Apr 16 '13 at 18:33
  • No I didn't because I was in too much of a hurry to try it out. When I did it, it gives me the [1]TRUE. Then I try my search again and I get this:[1] "SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed" Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) : Error: SSL certificate problem, verify that the CA cert is OK. Details: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed – Phil A Apr 16 '13 at 18:44
  • @SimonO101 I think the problem I'm now getting has been answered elsewhere on this forum: http://stackoverflow.com/questions/9916283/twitter-roauth-and-windows-register-ok-but-certificate-verify-failed?rq=1 Thanks for your help, I will read that q&a to try and get over the latest hump. – Phil A Apr 16 '13 at 18:51

1 Answers1

1

I had similar problems, and had to make two changes.

1 - change all https to http as mentioned by SimonO101

2 - make sure to delete the callback URL - otherwise rather than displaying the PIN is simply moved on to the callback URL destination

ClintI
  • 27
  • 7