I am currently trying to send tweets from R, but I cannot get around the following error:
Error in .self$twFromJSON(out) :
Error: Could not authenticate with OAuth.
I have followed the directions in the twitteR vignette and the other stackoverflow questions concerning the matter (http://stackoverflow.com/questions/8122879/roauth-on-windows-using-r), but none seem to get around this error. Here is the code I am using:
library("twitteR")
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 = "*****************************"
consumerSecret = "************************"
Cred <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=requestURL,
accessURL=accessURL,
authURL=authURL)
Cred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
registerTwitterOAuth(Cred)
Through here works. registerTwitterOAuth returns TRUE, so you would think that everything worked. But when I try and send a tweet, I get the error listed above.
I'm trying to send a tweet by doing:
tweet("text to tweet")
This results in:
Error in .self$twFromJSON(out) :
Error: Could not authenticate with OAuth.
Not sure what's going wrong. The OAuth validation seems to work, but then I am unable to send tweets.