尝试通过R(TwitteR)访问Twitter应用时,我无法获取PIN码。当它向我提供URL并询问PIN时,URL只指向我的网站(在Chrome中)。在Safari和Firefox中,该网站称“需要SSL”。我在控制台中没有任何错误消息;但是,此时我不知道从哪里获取PIN码(我已经搜索过了所有内容)。感谢任何帮助。
据我所知,我已正确设置Twitter应用中的所有设置。
download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
library(RCurl)
# Set SSL certs globally (I tried this after it didn't work without it)
options(RCurlOptions = list(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")))
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- "xxxxxxxxxxxxxx"
consumerSecret <- "xxxxxxxxxxxxxxxx"
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=reqURL,
accessURL=accessURL,
authURL=authURL)
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))
答案 0 :(得分:0)
您需要将握手返回的链接协议更改为https(默认情况下为http)。