0

我尝试按照 R 的 twitteR 包中的简单示例连接到 Twitter。我创建了一个应用程序,获得了客户密钥和秘密。我调用 twitCred$handshake(),获取 URL,授权应用程序并获取 pin。到目前为止,一切都很好。但是当我输入密码时,我总是得到错误:禁止。

任何帮助apprechiated!

这是我的会话信息:

> sessionInfo()
R version 3.1.0 (2014-04-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] twitteR_1.1.7  rjson_0.2.13   ROAuth_0.9.3   digest_0.6.4   RCurl_1.95-4.1 bitops_1.0-6  

loaded via a namespace (and not attached):
[1] tools_3.1.0

这是代码:

library(twitteR)
library(ROAuth)

## A real example, but using a fictitious consumerkey and consumer
## secret - you’ll need to supply your own
reqURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "http://api.twitter.com/oauth/access_token"
authURL <- "http://api.twitter.com/oauth/authorize"
consumerKey <- "..."
consumerSecret <- "..."
twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                             consumerSecret=consumerSecret,
                             requestURL=reqURL,
                             accessURL=accessURL,
                             authURL=authURL)
twitCred$handshake()

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

0 回答 0