rtweet(): can't verify a successful connection

21 Views Asked by At

I am trying to use the Twitter API (v1.2.1), and want to confirm that I am authorized and connected to the API, before further coding. When I run the code below, I get this message (not actual BEARER_TOKEN):

Error in $<-.data.frame(*tmp*, "entities", value = list(list())) : replacement has 1 row, data has 0

I've researched and am confused by the various modes and keys I've read about. But haven't found anything that works. Any clues anybody?

library(rtweet)
Sys.setenv(BEARER_TOKEN = "xxxx")

# Authenticate using the app credentials
app <- rtweet_app(bearer_token = Sys.getenv("BEARER_TOKEN"))
auth_as(app)

# Test the authentication - Look up a public Twitter user account
test_user <- tryCatch({
  lookup_users("twitter")
  error = function(e) NULL
})
0

There are 0 best solutions below