-
Notifications
You must be signed in to change notification settings - Fork 163
[1] "Using direct authentication" Error in check_twitter_oauth() : OAuth authentication error: This most likely means that you have incorrectly called setup_twitter_oauth()' #137
Comments
I get the same error |
Same here. |
I've tried the following: adding the old version of the httr package, turning my firewall off, adding the base64enc package and nothing worked... And yes, I have installed all the packages AND I used the library function before trying to use them. Here is my code library("base64enc") download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem") setup_twitter_oauth(consumerKey, consumerSecret, accessToken, accessTokenSecret) *key= for each line I added the corresponding key from my Twitter App page. |
I had this problem when I went to scrape tweets. I solved it by opening libraries for "httpuv" and "openssl". Session Info: Matrix products: default locale: attached base packages: other attached packages: loaded via a namespace (and not attached): Code below: #Load Libraries #Save your Twitter account Keys and Tokens. If you do not have a twitter account. https://apps.twitter.com/ consumer_key<-"code" #Connects you to Twitter #ChancellorDav Tweets #Sapply Approach #Overview of Data Scraped |
This library resolve my problem. |
when i run code OTP get generated but when i use "search" command error can be generated library(twitteR) #setup_twitter_oauth(consumer_key,consumer_secret,access_token,access_secret) download.file(url="http://curl.haxx.se/ca/cacert.pem",destfile="cacert.pem") setup_twitter_oauth(consumer_key,consumer_secret,access_token,access_secret) tcred <- OAuthFactory$new(consumerKey=consumer_key, tcred$handshake(cainfo="cacert.pem") Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) : version 3.4.3 please help me |
@nadeemkhan786 I get this error when I have poor internet. But you could fix the typos in your code so we're certain that we're on the same page.... |
@BroVic but i have good internet still i am in same place (error) |
I am getting following error. Can anybody guide me? Error in twInterfaceObj$doAPICall(cmd, params, "GET", ...) : |
Please, how to correct this error?
|
I wrote a code like this and got an error as below: |
Thanks a lot. Using library openssl and httpuv resolved my Error in check_twitter_oauth() : OAuth authentication error. I was getting worried and in the end of two days I read this post and nailed the error out of my program. Once again thanks!!! |
Share your code please @mayankvik2 |
check working directory |
library("twitteR") api_key <- " code" setup_twitter_oauth(api_key,api_secret,access_token,access_secret) |
Tried all the posted solutions but still face the same error: Please anyone help to resolve this weird problem. I'm trying for a week to solve this and checked almost all the related forums around the Web. Here is my last place to ask or I will uninstall R and start another language! |
Try changing the directory. Like say make a new folder in desktop and save it there and then write path C:/filename/desktop
On 21-Apr-2018, at 3:30 PM, jack-81 <[email protected]<mailto:[email protected]>> wrote:
Tried all the posted solutions but still face the same error:
[1] "Using direct authentication"
Error in check_twitter_oauth() : OAuth authentication error:
This most likely means that you have incorrectly called setup_twitter_oauth()'
Please anyone help to resolve this weird problem. I'm trying for a week to solve this and checked almost all the related forums around the Web. Here is my last place to ask or I will uninstall R and start another language!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#137 (comment)>, or mute the thread<https://github.com/notifications/unsubscribe-auth/AkTNKiLiAb-2knTcbK5YbYgv2Cm_idPYks5tqwNQgaJpZM4LxENV>.
|
I think this is an important issue that has many solutions. Do you think setting a bounty on bountify can be helpful. I really need to solve this for an important project. |
Hi there,
For solving error check the following:
1.you have also downloaded certificates in case using windows for
interacting with twitter API..
download.file(url="http://curl.haxx.se/ca/cacert.pem",
destfile="cacert.pem") #downloads the certificate
2. If direct auhrntication showing error then first perfotm handshaking
with twitter API.
my_oauth <- OAuthFactory$new(consumerKey = consumerKey,
consumerSecret = consumerSecret,
requestURL = requestURL,
accessURL = accessURL,
authURL = authURL)
my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package =
"RCurl"))
Thats all!! In case you still found show issue ,then comment again with
complete code
…On Sat, Apr 21, 2018 at 3:32 AM, ddten ***@***.***> wrote:
Try changing the directory. Like say make a new folder in desktop and save
it there and then write path C:/filename/desktop
On 21-Apr-2018, at 3:30 PM, jack-81 ***@***.***<mailto:
***@***.***>> wrote:
Tried all the posted solutions but still face the same error:
[1] "Using direct authentication"
Error in check_twitter_oauth() : OAuth authentication error:
This most likely means that you have incorrectly called
setup_twitter_oauth()'
Please anyone help to resolve this weird problem. I'm trying for a week to
solve this and checked almost all the related forums around the Web. Here
is my last place to ask or I will uninstall R and start another language!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://github.com/
geoffjentry/twitteR#137#issuecomment-383282516>, or mute the
thread<https://github.com/notifications/unsubscribe-auth/AkTNKiLiAb-
2knTcbK5YbYgv2Cm_idPYks5tqwNQgaJpZM4LxENV>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#137 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Akr05Uqd171gUaPdlZjdoBg5EefWMZpoks5tqwrOgaJpZM4LxENV>
.
|
I exactly have the same issue, I have tried everything! it is so frustrating, Let me know if you solve it and how did you do it. I am still working on it too. |
Have you both @monitotier @mayankvik2 tried to set the working directory? Like if you make a new folder on desktop named say R Studio then set the working directory as that? api_key <- " code" setup_twitter_oauth(api_key,api_secret,access_token,access_secret) |
@ddten: Thanks for your quick response. After going through more threads I found that this package was missing "base64enc". It helped! |
Thanks for the solution. We have a new error!
Following your suggested steps, the following error was arised!
Error in function (type, msg, asError = TRUE) :
Failed to connect to api.twitter.com port 443: Timed out
Win 7, R 3.4.4.
On Sun, Apr 22, 2018 at 4:52 AM, mayankvik2 <[email protected]>
wrote:
… Hi there,
For solving error check the following:
1.you have also downloaded certificates in case using windows for
interacting with twitter API..
download.file(url="http://curl.haxx.se/ca/cacert.pem",
destfile="cacert.pem") #downloads the certificate
2. If direct auhrntication showing error then first perfotm handshaking
with twitter API.
my_oauth <- OAuthFactory$new(consumerKey = consumerKey,
consumerSecret = consumerSecret,
requestURL = requestURL,
accessURL = accessURL,
authURL = authURL)
my_oauth$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package =
"RCurl"))
Thats all!! In case you still found show issue ,then comment again with
complete code
On Sat, Apr 21, 2018 at 3:32 AM, ddten ***@***.***> wrote:
>
> Try changing the directory. Like say make a new folder in desktop and
save
> it there and then write path C:/filename/desktop
>
>
> On 21-Apr-2018, at 3:30 PM, jack-81 ***@***.***<mailto:
> ***@***.***>> wrote:
>
>
> Tried all the posted solutions but still face the same error:
> [1] "Using direct authentication"
> Error in check_twitter_oauth() : OAuth authentication error:
> This most likely means that you have incorrectly called
> setup_twitter_oauth()'
>
> Please anyone help to resolve this weird problem. I'm trying for a week
to
> solve this and checked almost all the related forums around the Web. Here
> is my last place to ask or I will uninstall R and start another language!
>
> —
> You are receiving this because you commented.
> Reply to this email directly, view it on GitHub<https://github.com/
> geoffjentry/twitteR#137#issuecomment-383282516>, or mute the
> thread<https://github.com/notifications/unsubscribe-auth/AkTNKiLiAb-
> 2knTcbK5YbYgv2Cm_idPYks5tqwNQgaJpZM4LxENV>.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/geoffjentry/twitteR/issues/
137#issuecomment-383284002>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/
Akr05Uqd171gUaPdlZjdoBg5EefWMZpoks5tqwrOgaJpZM4LxENV>
> .
>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#137 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Aky7RpIXnoHdPJ1x-c8kyEdDdmAO7kS7ks5tq81egaJpZM4LxENV>
.
|
I found the solution in a Stackoverflow post. try to run setup_twitter_oauth(consumer_key, consumer_secret) and see what libraries are missing then install them. |
Thanks guys. I got same issue resolved by following the instructions on this forum. I simply added all the required library and followed the advice from @ddten to regenerate the all the keys. Now i'm working perfectly. |
Thanks akinsbola452000 |
during handshake with twitter i get error :- setting working directorylibrary(twitteR) oauth_endpoint(authorize = "https://api.twitter.com/oauth", #connect to API Twitter ApplicationconsumerKey="3GcJah1mIIDPD6c4uIW08L8YU" cred <- OAuthFactory$new(consumerKey=consumerKey, There is URL in console. You need to go to it, get code and enter it on consoleAuthorization PIN ~DYNAMICsave(cred, file='twitter authentication.Rdata') load('twitter authentication.Rdata') Once you launch the code first time, you can start from this in the future(libraries should be connected)setup_twitter_oauth(consumer_key = consumerKey,consumer_secret = consumerSecret, ###*******Step 3: Performs tweets extraction and data cleaning Harvest some tweetssome_tweets = searchTwitter("statue of unity", n=5000, since = "2017-01-01", lang="en")some_tweets = searchTwitter("Sardar Vallab Bhai Patel",n=5000, since = "2017-01-01", lang = "en") (n.some_tweets <- length(some_tweets)) some_tweets.df <- ldply(some_tweets, function(t) t$toDataFrame()) get the textsome_txt = sapply(some_tweets, function(x) x$getText()) #remove request entities remove html linkssome_txt = gsub("http\w+","", some_txt) remove unnecessary spacessome_txt = gsub("[\t]{2,}","", some_txt) define "tolower error handling" functiontry.error = function(x) if not an errorif (!inherits(try_error, "error")) resultreturn(y) #Tower case using try.error with sapply remove NAS in some_txtsome_txt = some_txt[!is.na(some_txt)] } |
Ya u must have good internet connection.
…On Wednesday, November 28, 2018, PankajVerma123 ***@***.***> wrote:
during handshake with twitter i get error :-
Error in setup_twitter_oauth(consumer_key = consumerKey, consumer_secret
= consumerSecret, :
could not find function "setup_twitter_oauth. please suggest me solution
to this issue.
this is my rstudio code and i am using R 3.5.1
setting working directory
library(twitteR)
library(ROAuth)
library(plyr)
library(dplyr)
library(stringr)
library(ggplot2)
library(httr)
library(wordcloud)
library(SentimentAnalysis)
library(sentimentr)
library(RCurl)
library(openssl)
library(httpuv)
library(base64enc)
library(devtools)
oauth_endpoint(authorize = "https://api.twitter.com/oauth",
access = "https://api.twitter.com/oauth/access_token")
#connect to API
download.file(url ='http://curl.haxx.se/ca/cacert.pem', destfile
='cacert.pem')
reqURL <- 'https://api.twitter.com/oauth/request_token'
accessURL <- 'https://api.twitter.com/oauth/access_token'
authURL <- 'https://api.twitter.com/oauth/authorize'
Twitter Application
consumerKey="3GcJah1mIIDPD6c4uIW08L8YU"
consumerSecret="uevNdolvKfdCcG779UpiiD2wHTmP86kAUMqH7I9cjRuA3iJ35r"
accesstoken="869394410-vZb0G5EjJVF9STyLvVDotknPchwhcZ63zftWYyJe"
accesssecret="Ea3kWs4UCTqdNrWA76Wzall5MV2xRorrwlE8DYsc4ul5w"
cred <- OAuthFactory$new(consumerKey=consumerKey,
consumerSecret=consumerSecret,
requestURL=reqURL,
accessURL=accessURL,
authURL=authURL)
cred$handshake(cainfo = system.file('CurlSSL', 'cacert.pem', package =
'RCurl'))
There is URL in console. You need to go to it, get code and enter it on
console Authorization PIN ~DYNAMIC
save(cred, file='twitter authentication.Rdata')
load('twitter authentication.Rdata')
Once you launch the code first time, you can start from this in the
future(libraries should be connected)
setup_twitter_oauth(consumer_key = consumerKey,consumer_secret =
consumerSecret,
access_token = accesstoken,access_secret = accesssecret)
###********Step 3: Performs tweets extraction and data cleaning*
Harvest some tweets some_tweets = searchTwitter("statue of unity",
n=5000, since = "2017-01-01", lang="en")
some_tweets = searchTwitter("Sardar Vallab Bhai Patel",n=5000, since =
"2017-01-01", lang = "en")
(n.some_tweets <- length(some_tweets))
some_tweets.df <- ldply(some_tweets, function(t) t$toDataFrame())
write.csv(some_tweets.df,"tweets.csv")
get the text
some_txt = sapply(some_tweets, function(x) x$getText())
#remove request entities
some_txt = gsub("(RT/via)((?:\b\w*@\w+)+)","", some_txt)
#remove at people
some_txt = gsub("@\w+", "", some_txt)
#remove punctuation
some_txt = gsub("[[:punct:]]", "", some_txt)
#remove numbers
some_txt = gsub("[[:digit:]]","", some_txt)
remove html links
some_txt = gsub("http\w+","", some_txt)
remove unnecessary spaces
some_txt = gsub("[\t]{2,}","", some_txt)
some_txt = gsub("^\s+|\s+$","", some_txt)
define "tolower error handling" function
try.error = function(x)
{
#creating missing values
y = NA
#try catch error
try_error = tryCatch(tolower(x), error=function(e) e)
if not an error
if (!inherits(try_error, "error"))
y = tolower(x)
result
return(y)
}
#Tower case using try.error with sapply
some_txt = sapply(some_txt, try.error)
remove NAS in some_txt
some_txt = some_txt[!is.na(some_txt)]
names(some_txt) = NULL
}
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#137 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AjBubIo-p0uyLnVNCdgpbi7pP7J_95dBks5uzl7mgaJpZM4LxENV>
.
|
anyone please help me find the issue with my code . i didn't get solution to this problem till yet, so please help me or send me r code to extract tweet that will be working in R 3.5.1.
|
Hello Guys,
When I try to establish establish a connection to the Twitter API, I get an error:
Please guide me on this. I have tried all the solutions offered in here, nothing worked for me.
The following is my R sessionInfo:
R version 3.3.2 (2016-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.3.2
Thanks,
Farnaz
The text was updated successfully, but these errors were encountered: