这个问题实际上回答了与twitteR ROAuth问题相关的所有问题:
TwitteR, ROAuth and Windows: register OK, but certificate verify failed
TwitteR和ROAuth以前都在我的电脑上工作得很好。但是代码块不再生成PIN选项了。它会弹出以下内容:
twitCred$handshake(cainfo="cacert.pem")
Error: Unauthorized以前,twitCred$handshake(cainfo="cacert.pem")指向:
To enable the connection, please direct your web browser to:
https://api.twitter.com/oauth/authorize?oauth_token=SevxcpCh9riO5PPrI8U8____
When complete, record the PIN given to you我在服务器上尝试了我的代码。然后代码工作得很完美(生成输入PIN的选项,而PIN目前不在我的pc中生成)。守则是:
require(twitteR)
require(ROAuth)
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)
setwd("/home/__")
download.file(url="http://curl.haxx.se/ca/cacert.pem", destfile="cacert.pem")
twitCred$handshake(cainfo="cacert.pem")
To enable the connection, please direct your web browser to:
https://api.twitter.com/oauth/authorize?oauth_token=SevxcpCh9riO5PPrI8U8____
When complete, record the PIN given to you任何帮助都是非常感谢的。
发布于 2014-05-04 10:48:20
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl"))这对我有用。
发布于 2014-11-20 10:37:02
Twitter应用程序必须具有读写权限。这就是让我绕过授权错误的原因。请注意以下说明:
在http://dev.twitter.com创建一个Twitter应用程序。确保给应用程序读、写和直接消息权限。注意到来自Twitter应用程序页面的以下值:"API键“、"API密钥”、“访问令牌”和“访问令牌机密”。
install.packages(c("devtools“、"rjson”、"bit64“、"httr"))确保此时重新启动R会话
库(Devtools) install_github("twitteR",username="geoffjentry")库(TwitteR) setup_twitter_oauth("API键“,"API机密”)
API密钥和API秘密来自上面的Twitter应用程序页面。这将引导您完成httr的OAuth身份验证过程。我建议您查看httr中令牌的手册页,以了解它如何处理缓存。
你应该准备好走了!
https://stackoverflow.com/questions/18157205
复制相似问题