本文介绍了check_twitter_oauth() 中的错误:OAuth 身份验证错误 - 无法通过 oauth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 R 的新手.我已经练习了几天的文本挖掘.我本使用相同的 OAuth 过程(实际上我几个小时前正在使用).偏偏,我无法通过授权过程.由于这个问题,我只是重新生成所有密钥并搜索答案,但我仍然遇到同样的问题.任何帮助将不胜感激.

I am a newbie on R. I haven practice text mining couple of days. I ben use same OAuth process (actually I am using a few hours ago). Middle of nowhere, I can't pass the authorization process. Because of the problem, I just regenerate all keys and search for answers but I still have same problem. Any help will be much appreciate it.

library(twitteR)
library(httr)
library(tm)
library(NLP)
library(SnowballC)
library(qdap)

> consumer_key <- '**consumer_key**'

> consumer_secret <- '**consumer_secret**'

> access_token <- '**access_token**'

> access_secret <- '**access_secret**'

> setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)

[1] "Using direct authentication"
Use a local file to cache OAuth access credentials between R sessions?
1: Yes
2: No

Selection: 1
Error in check_twitter_oauth() : OAuth authentication error:
This most likely means that you have incorrectly called setup_twitter_oauth()'

> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

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

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

other attached packages:
 [1] RCurl_1.95-4.6         bitops_1.0-6           qdap_2.2.1             RColorBrewer_1.1-2
 [5] qdapTools_1.1.0        qdapRegex_0.3.2        qdapDictionaries_1.0.6 SnowballC_0.5.1
 [9] tm_0.6-1               NLP_0.1-7              httr_1.0.0             twitteR_1.1.8

loaded via a namespace (and not attached):
 [1] gtools_3.5.0        wordcloud_2.5       venneuler_1.1-0     slam_0.1-32
 [5] reshape2_1.4.1      rJava_0.9-6         reports_0.1.4       colorspace_1.2-6
 [9] chron_2.3-47        XML_3.98-1.2        DBI_0.3.1           bit64_0.9-4
[13] plyr_1.8.3          stringr_1.0.0       munsell_0.4.2       gtable_0.1.2
[17] devtools_1.8.0      memoise_0.2.1       gender_0.4.3        parallel_3.2.0
[21] curl_0.9            xlsxjars_0.6.1      proto_0.3-10        Rcpp_0.11.6
[25] scales_0.2.5        plotrix_3.5-12      gdata_2.16.1        xlsx_0.5.7
[29] rversions_1.0.1     openNLPdata_1.5.3-2 jsonlite_0.9.16     bit_1.1-12
[33] gridExtra_0.9.1     rjson_0.2.15        ggplot2_1.0.1       digest_0.6.8
[37] stringi_0.5-2       dplyr_0.4.2         grid_3.2.0          tools_3.2.0
[41] magrittr_1.5        MASS_7.3-41         data.table_1.9.4    xml2_0.1.1
[45] assertthat_0.1      rstudioapi_0.3.1    openNLP_0.2-5       R6_2.0.1
[49] igraph_1.0.0        git2r_0.10.1

推荐答案

我有以下代码可以正常工作.确保您已安装最新版本的软件包.

I have the following code working fine for me. Make sure you have installed the latest version of package.

options(httr_oauth_cache=T)
api_key <- "api_key here"
api_secret <- "api_secret here"
access_token <- "access_token here"
access_token_secret <- "access_token_secret here "
setup_twitter_oauth(api_key,api_secret,access_token,access_token_secret)

这篇关于check_twitter_oauth() 中的错误:OAuth 身份验证错误 - 无法通过 oauth的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 21:00