简体   繁体   中英

How to use rtweet on rstudio.cloud?

I want to authenticate with Twitter (Rtweet package) via rstudio.cloud. The problem is that the authentication opens a new page each time where I am supposed to authorise via Twitter. When I am redirected back from there, I end up in nirvana.

library (rtweet)
> search_users("#ICForumCH", n = 10)
Requesting token on behalf of user...
Waiting for authentication in browser...
Press Esc/Ctrl + C to abort

-> Twitter authentication Page ->

Hmmm… can't reach this page
127.0.0.1 refused to connect.

I found this solution from community.rstudio.com but cannot seem to make it work.

Oh, and please don't tell me I need a desktop version. I will never get the necessary permissions at my workplace.

If You have The twitter account logged in your default browser this may work for you.

Run this code first,

library(rtweet)
auth_setup_default()
# Using default authentication available.
# Reading auth from 'C:\Users\XXX\AppData\Roaming/R/config/R/rtweet/default.rds'

You can take default.rds file and upload it to your RStudio.cloud folder.

Just use

auth_as("foldername/default.rds")

before post a tweet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM