rtweet problem: authentication fails in user_oauth2

79 Views Asked by At

I am trying to pull tweets using rtweet. I have basic-level developer access. I am using the following code:

require(httr)
library(httpuv)
library(base64enc)
require(rtweet)

client <- rtweet_client(client_id= "xxxxxxxxxxxxxxxxxxx", 
                    client_secret = "xxxxxxxxxxxxx",
                    app = "xxxxxxxxxxxxxxx")
client_as(client)
user_oauth2 <- rtweet_oauth2()

and my callback URI is http://127.0.0.1:1410/ , as suggested in the Twitter developer documentation. When I submit the final line of the code, I am transferred to the authorization page, but when I try to authorize the app, I get an error:

This site can’t be reached 127.0.0.1 refused to connect.

And R is stuck in the authentication stage:

Waiting for authentication in browser...
Press Esc/Ctrl + C to abort

Any idea how to overcome this issue?

Thanks,

Eitan

I am using R on posit cloud. Session info below

sessionInfo()

R version 4.3.0 (2023-04-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3.10.3 
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3;  LAPACK version 3.9.0

locale:
[1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8    
[5] LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8    LC_PAPER=C.UTF-8       LC_NAME=C             
[9] LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   
0

There are 0 best solutions below