Comments (12)
Thanks a lot! Now seems working fine!
from rtweet.
You'll have to make sure to replace the xxxxxx
s with the appropriate keys. If you only made one app, then you'd want to change the code to only include one create_token()
call (like code below).
twitter_tokens <- create_token(app = "my_app",
consumer_key = "asfdaSDfiuSDFoqewirhsf",
consumer_secret = "ioasuSYrERKSisdffaoweSDFffdyfp")
# these are not real tokens, they should be replaced with values described in
# obtaining and using access tokens guide.
You could also try installing the github version. There was an unstated dependency, the httpuv
package. That shouldn't be the cause here, but it's worth a short. The Github version also has built-in tokens now as well, which will get you going in the short term---in the long term, I wouldn't rely on the built-in tokens as their performance is likely to be inconsistent.
install.packages("devtools")
devtools::install_github("mkearney/rtweet")
library(rtweet)
tw <- search_tweets("rstats")
head(tw)
from rtweet.
@valentinap This same problem error comes up if you leave an extra space when copy/pasting the keys or if you forget to enter the callback URL. I'm guessing the latter is more likely. To fix it, go to https://apps.twitter.com, click on your app, and then select "settings." For "callback url" enter the following
http://127.0.0.1:1410
from rtweet.
Sorry to bother you again. I had my callback URL as the one you specified before. But even then it is not working . httroauth is not my current working directory. Could you please advice me how to proceed ? The main purpose I wanted to use rtweets is I can use extended keyword which can take more characters. This is actually failing for me
from rtweet.
There are three ways to setup authorization to interact with Twitter's API through rtweet:
- Save token(s) and setup an environment variable (recommended method).
- Ideally, you'd setup an environment variable that contains a path to your saved token(s). I made a tokens vignette that describes how to do that, so I'd encourage you to follow that method.
- Create token(s) object and use token argument.
- Another method is to create a token and then specify it as the "token" argument in each call. An example of this can be found in the README file.
- Use token(s) originally created for the twitteR package.
- For ease of transition, I added some checks to see if an .httr-oauth file was already generated, following the instructions provided by the twitteR package. Depending on system cache options, this can create a problem. Fortunately, until I fix this (which I hope to do relatively soon), the other two methods should still work.
If you've done any/all of that and you're still getting that error, can you share your code so I can get a better idea of what might be going wrong?
from rtweet.
Sorry to reply so in late. I'm following your vignette but when I put my data to create a twitter token I get the following error:
Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission, :
Unauthorized (HTTP 401).
This is the code:
twitter_tokens <- c(
create_token(app = "my_app",
consumer_key = "xxxxxxxxxxxxxxx",
consumer_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXX"),
create_token(app = "my_app",
consumer_key = "xxxxxxxxxxxxxxx",
consumer_secret = "XXXXXXXXXXXXXXXXXXXXXXXXXX"))
Thanks in advance for your help
from rtweet.
I gave the callback URL as above and also tried to search the tweet. But I am getting the same error
library(rtweet)
library(twitteR)
Attaching package: ‘twitteR’
The following object is masked from ‘package:rtweet’:
lookup_statuses
library(ROAuth)
setup_twitter_oauth("consumer key",
- "consumer secret",
- "access token",,
- "access secret")
[1] "Using direct authentication"
trump=search_tweets("DonaldTrump",n=10)
Error in readRDS(pat) : error reading from connection
from rtweet.
@mosrihari this is because R is reading the wrong token. for reference: https://github.com/mkearney/rtweet/issues/141
from rtweet.
Hi mkearney, Even then I am not able to connect to twitter. With reference to #141 , I removed my httr.oauth in my current directory and tried the same. Please note that my current working directory doesnt have .httr.oauth
Please advice on the below code
library(rtweet)
Warning message:
package ‘rtweet’ was built under R version 3.4.3
appname <- "Srihari_NTU"
key <- "consumer key"
secret <- "consumer secret"
twitter_token <- create_token(
- app = appname,
- consumer_key = key,
- consumer_secret = secret)
Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission, :
Unauthorized (HTTP 401).
rstats_tweets <- search_tweets(q = "#rstats",
-
n = 500)
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort
Error in shell.exec(url) :
file association for 'https://api.twitter.com/oauth/authenticate?oauth_token=zLGxnQAAAAAAxSTkAAABYXOT5qM&permission=read' not available or invalid
from rtweet.
Perhaps @mosrihari it's the callback URL that needs to be corrected. Go to https://apps.twitter.com, select your app, and set callback URL to http://127.0.0.1:1410
from rtweet.
@mkearney I have the same problem as @mosrihari . My callback URL is correct, I had deleted the .httr-oauth file. I still get
Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission, :
Unauthorized (HTTP 401).
from rtweet.
I have also tried changing the callback Url to http://127.0.0.1:1410 ,but with zero luck..i am still getting the same error
from rtweet.
Related Issues (20)
- Information on whether a tweet has been quoted is missing HOT 7
- rweet not working with new paid Basic Twitter API v2 app, asking for elevated access HOT 1
- search_tweets fails with error 403 HOT 4
- OAuth 2.0 expected when OAuth 1.0 is also possible (tweet_post) HOT 19
- 404 retrieving timeline HOT 2
- Cryptic error message
- Error: Twitter API failed [403] HOT 1
- tweet_post with media HOT 11
- Automatic renewal of OAuth2 token HOT 17
- Testing new functions
- Error OAuth 2.0 post tweet via Free Access. HOT 1
- Fix rtweet for NULL not being atomic values on CRAN?
- Release rtweet 1.2.1 HOT 1
- auth_sitrep errors in old tokens/files
- `post_tweet()` with `rtweet_bot()` no longer works HOT 15
- Release rtweet 2.0.0
- API v2 not handling response body errors correctly for missing reference tweets HOT 1
- API v2 raising error on successful response HOT 5
- tweet_search_recent() HOT 3
- Problem with client authentication, and auth_sitrep() with no output HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rtweet.