Skip to content

Instantly share code, notes, and snippets.

@alstat
Last active July 13, 2019 06:07
Show Gist options
  • Save alstat/9656597 to your computer and use it in GitHub Desktop.
Save alstat/9656597 to your computer and use it in GitHub Desktop.
library(RCurl)
# Set SSL certs globally
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
library(twitteR)
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"
apiKey <- "xxxxxxxxxxxxxxxxxxxxxx"
apiSecret <- "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
twitCred <- OAuthFactory$new(
consumerKey = apiKey,
consumerSecret = apiSecret,
requestURL = reqURL,
accessURL = accessURL,
authURL = authURL
)
twitCred$handshake(
cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")
)
registerTwitterOAuth(twitCred)
@bzdzeng
Copy link

bzdzeng commented Feb 16, 2016

There seems to be a new way to do this now, the above ways didn't work for me.

library(ROAuth)

  apiKey <- "#####"
  apiSecret <- "####"
  actoken <- "#####"
  acsecret <- "#####"

setup_twitter_oauth(
  apiKey , 
  apiSecret,
  actoken,
  acsecret
)

After that is done you'll have direct access. More straightforward IMO.

@mis6306
Copy link

mis6306 commented Apr 2, 2016

install.packages("twitteR")
install.packages("ROAuth")
library(twitteR)
library(ROAuth)
require(RCurl)

@Andrevw2812
Copy link

Thanks sickopath, your solution (and mis6036) worked perfectly.

@kaivan-s
Copy link

Thanks mis6306, Solution working good !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment