0

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   
user1807435
  • 35
  • 1
  • 6
  • Which version of rtweet are you using? Are you connected to the internet? Does a tab in your default browser open with a Twitter page or not? I am not sure if because you are working in posit cloud the browser it doesn't find the default browser to open it. – llrs Aug 07 '23 at 09:10
  • I am using rtweet version 1.2.0.9003 and am connected to the internet. The twitter page opens, asking me to authorize the app. – user1807435 Aug 30 '23 at 10:20
  • Ok, then it seems that the configuration of your own app doesn't match what rtweet expects. Could you provide how have you configured the app? – llrs Aug 30 '23 at 21:07
  • Another option is that the client and the app do not match... – llrs Aug 31 '23 at 14:57

0 Answers0