Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R TwitteR package authorization error

I am following the latest update on twitteR homepage, and I can't pass the authorization process.

library(devtools)
install_github("twitteR", username="geoffjentry")

library(twitteR)
api_key <-  "XXXXXXXXXXXXXXXXX"
api_secret <- "XXXXXXXXXXXXXXXXX"
access_token <- "XXXXXXXXXXXXXXXXX"
access_secret <- "XXXXXXXXXXXXXXXXX"
setup_twitter_oauth(api_key, api_secret, access_token, access_secret)

This is the output I am getting back:

[1] "Using direct authentication"
Error in check_twitter_oauth() : OAuth authentication error:
This most likely means that you have incorrectly called setup_twitter_oauth()'

I have also tried setup_twitter_oauth(api_key, api_secret), and this is the error message:

[1] "Using browser based authentication"
Error in init_oauth1.0(endpoint, app, permission = params$permission) : 
client error: (401) Unauthorized

I don't think there are any other options in setup_twitter_oauth. Does anyone else encounter this error?

like image 339
Boxuan Avatar asked Sep 15 '14 20:09

Boxuan


2 Answers

set callback url to http://127.0.0.1:1410 in app settings in twitter

like image 119
shopa Avatar answered Oct 05 '22 06:10

shopa


This error happens when your app is missing the callback url. To solve this issue go to https://apps.twitter.com/ select your application and then go to SETTINGS scroll down to CALLBACK URL and enter ( http://127.0.0.1:1410 ). This should allow you to run browser verification.

enter image description here

Or you can enter the access_token and access_secret in R to trigger local verification.

 consumer_key   <- " YOUR CONSUMER KEY "
 consumer_secret<- " YOUR CONSUMER SECRET "
 access_token   <- " YOUR ACCESS TOKEN "
 access_secret  <- " YOUR ACCESS SECRET "
 setup_twitter_oauth(consumer_key, consumer_secret, access_token, access_secret)
like image 28
jlroo Avatar answered Oct 05 '22 07:10

jlroo