首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Windows上使用R的ROauth,授权后无效响应

在Windows上使用R的ROauth,授权后无效响应
EN

Stack Overflow用户
提问于 2013-04-23 17:07:34
回答 1查看 799关注 0票数 0

我在R中使用了下面的脚本,但是当我将用户重定向到oauth浏览器时。然后输入PIN,它打印一个错误。在这种情况下请帮帮我。谢谢。

代码语言:javascript
复制
cred=OAuthFactory$new(consumerKey="xxxxx",consumerSecret="xxxxx",requestURL="https://api.twitter.com/oauth/request_token",accessURL="https://api.twitter.com/oauth/authorize",authURL="https://api.twitter.com/oauth/access_token");
cred$handshake(cainfo="cacert.pem");

To enable the connection, please direct your web browser to: 
https://api.twitter.com/oauth/access_token?oauth_token=xxxxxxxxxxxxxxxxxxxx
When complete, record the PIN given to you and provide it here: xxxx

Error in cred$handshake(cainfo = "cacert.pem") :  Invalid response after authorization.  
You likely misentered your PIN, try rerunning this handshake & browser authorization to get a new PIN.

sessionInfo() R版本3.0.0 (2013-04-03)平台:x86_64-W64-mingw32 32/x64(64位)

代码语言:javascript
复制
locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

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

other attached packages:
[1] httr_0.2

loaded via a namespace (and not attached):
[1] digest_0.6.3   RCurl_1.95-4.1 stringr_0.6.2  tools_3.0.0   
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-04-23 18:24:02

代码中有错误的URL。用https代替http

代码语言:javascript
复制
requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL = "http://api.twitter.com/oauth/access_token"
authURL = "http://api.twitter.com/oauth/authorize"
consumerKey = "mykey"
consumerSecret = "mysecret"
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)

我通常会写这个作为评论,但这似乎是经常出现的。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16175194

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档