Did Twitter cut off access? rtweet no longer authenticating

The rtweet package v. 1.2.0 updates rtweet to work with the new endpoints using API v.2.

However, rtweet_oath2() does not work. It just says “something went wrong” and it doesn’t work even after logging in again.

It appears others are having this issue as well.I think it may have something to do with twitter cutting down on third-party apps. See, e.g.:

I can still authenticate with a default user so I can use, for example, get_followers(), but post_unfollow_user() gives me a “Your credentials do not allow access to this resource” error.

@llrs suggested I add this here. I have a free tier account. Is there a way for users to authenticate on Twitter again? rtweet is an awfully useful tool for the R community.

Hi Lucia,

There are several important points of what you ask.

Let me first clarify some points:You can not longer authenticate with the default user. As explained by Michael W. Kearney in this tweet, the default user was banned from Twitter.
I documented it in an issue and in another more accessible one.

You might authenticate with your own user but only if you set up your developer account.

To try to solve the problem with rtweet_oath2(), I would need to know the output of auth_sitrep() and client_list(). And please provide the steps you do until that message.

Ah okay thanks.Sorry I assumed if I could do some things but not others that it must be the default user. I guess you can say I had a faulty default to the default! Haha.

Here is the result:

> auth_sitrep()
Tokens from rtweet version < 1.0.0 found on /Users/Lucia:
Multiple authentications with the same key found!
Multiple authentications with the same app found!
Choose which is the best path of action for the tokens:
                               app    user_id key
.rtweet_token   Hilary_of_Poitiers   55876525   B
.rtweet_token1             Cantius 3815220455   A
.rtweet_token10            Cantius   55876525   A
.rtweet_token11            Cantius   55876525   A
.rtweet_token12            Cantius   55876525   A
.rtweet_token13            Cantius   55876525   A
.rtweet_token14            Cantius   55876525   A
.rtweet_token15 Hilary_of_Poitiers   55876525   B
.rtweet_token16 Hilary_of_Poitiers   55876525   B
.rtweet_token17 Hilary_of_Poitiers   55876525   B
.rtweet_token18 Hilary_of_Poitiers   55876525   B
.rtweet_token19 Hilary_of_Poitiers   55876525   B
.rtweet_token2             Cantius 3815220455   A
.rtweet_token20 Hilary_of_Poitiers   55876525   B
.rtweet_token3             Cantius 3815220455   A
.rtweet_token4             Cantius 3815220455   A
.rtweet_token5  Hilary_of_Poitiers 3815220455   B
.rtweet_token6             Cantius 3815220455   A
.rtweet_token7  Hilary_of_Poitiers 3815220455   B
.rtweet_token8             Cantius   55876525   A
.rtweet_token9             Cantius 3815220455   A
Tokens found on /Users/Lucia/Library/Preferences/org.R-project.R/R/rtweet:
                  token
my_authentication     A
                      app user_id key
my_authentication1 rtweet           A
All tokens should be moved to /Users/Lucia/Library/Preferences/org.R-project.R/R/rtweet

> client_list()
[1] "rtweet"

I can also move this to an issue on github, I’m not sure if it would be more appropriate there. Thank you for your help.

To open an issue in rtweet, first we need to know if there is a problem in rtweet. So far the problems is that you can’t authenticate but we don’t know if it is rtweet fault or Twitter.
Unless you think rtweet is doing something it shouldn’t (and can show it to me why/how) do not open an issue.

I see you have 21! files saved for two apps in /Users/Lucia: Hilary_of_Poiters and Cantius. Both apps are used with two different users: 3815220455 and 55876525. The good news is that you didn’t mix the bearer tokens.
Start by checking which token work as you expect and clean those duplicated. You don’t need to have those many, and it can lead to confusion. I would move only one valid for each app to the /Users/Lucia/Library/Preferences/org.R-project.R/R/rtweet folder (as the function output says). All the others tokens at /Users/Lucia could be deleted.

The newer authentication my_authentication1 works? Test it with auth_as("my_authentication1") and report back the error message (if any) in several endpoints (Both the new from API v2 and from API v1.1, like tweet_threading()) .

About your original question about rtweet_oauth2() I could renew access to a user, so I don’t think there is any issue with the package. Could you provide more information about the steps you did and what did you get?

2 Likes

That’s a good idea to delete the duplicates. Honestly I have tried to rejigger this so many times trying to get it to work that I forget what’s what and I want to make sure one works before I delete anything but then I will do that.

Here are the steps I took:

> auth <- rtweet_app() #then I entered my bearer token and it worked
> auth_as("my_authentication")
Reading auth from '/Users/Lucia/Library/Preferences/org.R-project.R/R/rtweet/my_authentication.rds'
#this also worked

> get_friends("17271646")
# A tibble: 3,302 × 2
   from_id  to_id             
   <chr>    <chr>             
 1 17271646 750409219401191425
 2 17271646 610194331         
 3 17271646 3548455875        
 4 17271646 261839748         
 5 17271646 186752984         
 6 17271646 342775091         
 7 17271646 4877908761        
 8 17271646 712463329013403649
 9 17271646 789173169932251136
10 17271646 808029864792117248
# ℹ 3,292 more rows
# ℹ Use `print(n = ...)` to see more rows

> post_unfollow_user("17271646") #this previously worked but no longer does. 
Error: Twitter API failed [403]. Check error message at https://developer.twitter.com/en/support/twitter-api/error-troubleshooting 
 * Your credentials do not allow access to this resource. (220)

> rtweet_oauth2() #this has never worked for me
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort

Then a browser window opens and this pops up:


I tried logging out and logging back in, that does not work.

I have tried adjusting my app settings, and that didn’t work.

This tweet pull counter is always at 0 of 2,000,000, I’m not sure if that is relevant. I have been all over the developer website, and I’m not seeing anything helpful.

My understanding was that with the free tier developer plan they at least let you access the functions, but not as many at one time. But maybe this policy has changed to a paid function? Or Twitter has broken this functionality when it implemented other changes? I take it others are experiencing the same issue?

Ughhh wait I’m sorry I missed you tweeting this, it looks like this is relevant: https://twitter.com/kearneymw/status/1643415552335986689?s=20 @mkearney were you able to sign up for the free tier?

Try refreshing the website you arrive after using rtweet_oauth2(). Alternatively, given that you have your own apps, you could create your own client with rtweet_client. Read the documentation to know how to do it.

The free tier only allows to post and read via the API v2: (aka: POST /2/tweets, DELETE /2/tweets/:id and GET /2/users/me). The first two are not supported in rtweet currently.

All the other endpoints are now for paid tiers. Even if Michael W. Kearney gets the default account back, it won’t allow to unfollow or follow people.

Okay thank you for your help.