Learn R Programming

vosonSML (version 0.26.3)

Authenticate.twitter: Twitter API authentication

Description

Twitter authentication uses OAuth and requires Application-user authentication API keys as described here: https://developer.twitter.com/en/docs/basics/authentication/overview/oauth.

Usage

# S3 method for twitter
Authenticate(socialmedia, appName, apiKey, apiSecret,
  accessToken, accessTokenSecret, useCachedToken = TRUE, ...)

Arguments

socialmedia

Character string. Identifier for social media API to authenticate, set to "twitter".

appName

Character string. Registered twitter app name associated with the API keys.

apiKey

Character string. API key to authenticate.

apiSecret

Character string. API secret to authenticate.

accessToken

Character string. API access token to authenticate.

accessTokenSecret

Character string. API access token secret to authenticate.

useCachedToken

Logical. Use cached access token if found otherwise create one. The cached token file is named .twitter-oauth and saved to the working directory.To refresh the cached token this file has to be manually deleted. Default is TRUE.

...

Additional parameters passed to function. Not used in this method.

Value

A credential object containing an access token $auth and social media type descriptor $socialmedia set to "twitter". Object has the class names "credential" and "twitter".

Examples

Run this code
# NOT RUN {
# twitter authentication with api keys
myKeys <- list(appName = "vosonSML", apiKey = "xxxxxxxxxxxx",
  apiSecret = "xxxxxxxxxxxx", accessToken = "xxxxxxxxxxxx",
  accessTokenSecret = "xxxxxxxxxxxx")

twitterAuth <- Authenticate("twitter", appName = myKeys$appName, 
  apiKey = myKeys$apiKey, apiSecret = myKeys$apiSecret, accessToken = myKeys$accessToken, 
  accessTokenSecret = myKeys$accessTokenSecret, useCachedToken = TRUE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab