knitr::opts_chunk$set(echo = TRUE, eval = FALSE, comment = "#>", collapse = TRUE)

rtweet

This vignette covers how to obtain and use Twitter API access tokens for use in the rtweet package.

Creating a Twitter App

creating

Authorization methods

Users can create their personal access token in two different ways. Each method is outlined below.

1. Browser-based authentication

## install httpuv if not already
if (!requireNamespace("httpuv", quietly = TRUE)) {
  install.packages("httpuv")
}

created

keys

## autheticate via web browser
token <- create_token(
  app = "rtweet_token",
  consumer_key = "XYznzPFOFZR2a39FwWKN1Jp41",
  consumer_secret = "CtkGEWmSevZqJuKl6HHrBxbCybxI1xGLqrD5ynPd9jG0SoHZbD")
## check to see if the token is loaded
identical(twitter_token, get_token())

2. Access token/secret method

created

keys

gen_token

acesskeys

## authenticate via access token
token <- create_token(
  app = "my_twitter_research_app",
  consumer_key = "XYznzPFOFZR2a39FwWKN1Jp41",
  consumer_secret = "CtkGEWmSevZqJuKl6HHrBxbCybxI1xGLqrD5ynPd9jG0SoHZbD",
  acess_token = "9551451262-wK2EmA942kxZYIwa5LMKZoQA4Xc2uyIiEwu2YXL",
  access_secret = "9vpiSGKg1fIPQtxc5d5ESiFlZQpfbknEN1f1m2xe5byw7")
## check to see if the token is loaded
identical(twitter_token, get_token())

That's it!



mkearney/rtweet documentation built on Sept. 29, 2021, 12:01 p.m.