Where does twitteR PIN code appear during R oauth authentication?

3.2k views Asked by At

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.

1

There are 1 answers

0
ClintI On

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