Access to Twitter Streaming APIs Using R using streamR & ROAuth

502 Views Asked by At

I am attempting to connect to Twitter's Streaming API in R. My code (including a fake consumer key and secret) is as follows:

library(streamR)
library(ROAuth)
requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- "xxxxxxxyyyyyyyyzzzzzzzz"
consumerSecret <- "xxxxxxxyyyyyyyyzzzzzzzz123123123123123"
my_oauth <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret, requestURL=requestURL,
accessURL=accessURL, authURL=authURL)
my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))

When I enter this code, I get the following message (although I have altered the web address):

To enable the connection, please direct your web browser to: 
http://api.twitter.com/oauth/authorize?oauth_token=xxxxxxxyyyyyyyyzzzzzzzz
When complete, record the PIN given to you and provide it here: 

The next thing I see is the following screen in my browser:

Au

I select "Authorize app", and I am navigated away from api.twitter.com. I never see the PIN that I need in order to progress forward.

Any ideas regarding how to solve this problem (and retrieve the PIN that I need in order to enable the connection I'm trying to create) are welcome!

2

There are 2 best solutions below

0
On

You just need to enter the pin into your RSTudio Console

0
On

I removed the callback URL and this solved the problem.