No PIN generated when using ROAuth to authenticate on Twitter

875 Views Asked by At

I'm trying to authenticate with Twitter using R, but I can't get a PIN.

The code I have is as follows:

download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")

reqURL <- "http://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- "foo"
consumerSecret <- "bar"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                             consumerSecret=consumerSecret,
                             requestURL=reqURL,
                             accessURL=accessURL,
                             authURL=authURL
                             )
twitCred$handshake(cainfo="cacert.pem", ssl.verifypeer=FALSE)

However, when I get the authorisation URL back and type that in, I still don't get a PIN : I just have a button to authorise the app, and then I end up back at the return URL I've previously specified.

This seems a very similar situation to this question Where does twitteR PIN code appear during R oauth authentication? but the remedy there (to ensure the request, access and auth URLs are all http rather than https) doesn't work for me.

I'm running R 3.0.0 on Windows 7, ROAuth is 0.9.2, twitteR 1.1.0 - any of those indicate why this problem is occurring?

1

There are 1 best solutions below

0
On

The url returned from Twitter after authorizing the app had a "oauth_verifier". I used this as the PIN in R. I was able to copy and paste it into R where it asked for the PIN. No text appeared in R until I hit enter. The PIN seemed to be accepted. I tried registerTwitterOAuth(cred) and the TRUE response was returned. However, I'm still having problems getting any info returned from a search:

download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem") options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
r_stats<- searchTwitter("#Rstats", n=100, cainfo="cacert.pem")

[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