Search code examples
rrtweet

RTweet: change Twitter account


I've been trying out the Rtweet package, found here: https://github.com/ropensci/rtweet

After posting a tweet with the post_tweet() command, I was sent to a browser page and was immediately logged in because of an automatic password program. The command worked, but I want to use it with another twitter account.

I want to change accounts but in the documentation there doesn't seem any method for changing the account. I guess my tokens are saved somewhere in a environment variable but I can't find it (I've looked in appData/local and appData/roaming, on a Windows computer obviously). If possible I don't want to apply for a separate App.

Any ideas on how I can delete my old login information and login with another account?


Solution

  • Thanks to the creator of the package:

    The following will delete your current token and then unset your environment variable:

    unlink(Sys.getenv("TWITTER_PAT"))
    Sys.unsetenv("TWITTER_PAT")