Learn R Programming

twitteR (version 0.99.2)

registerTwitterOAuth: Register OAuth credentials to twitter R session

Description

This function is used to provide your OAuth access tokens to your twitter session. This will enable many bits of functionality as well as allow other commands to provide more options

Usage

registerTwitterOAuth(oauth)

Arguments

oauth
An object of class OAuth

Value

  • TRUE on success, otherwise an error will be thrown

Details

This function will store the OAuth argument in an environment which is then accessed throughout the package. When API calls are made, instead of going through RCurl they will go through the ROAuth package.

Three URLs will need to be used for the initial OAuth handshake, see the examples below.

See Also

OAuth

Examples

Run this code
## A real example, but using a fictitious consumerkey and consumer
       ## secret - you'll need to supply your own
       requestURL <- "https://api.twitter.com/oauth/request_token"
       accessURL = "http://api.twitter.com/oauth/access_token"
       authURL = "http://api.twitter.com/oauth/authorize"
       consumerKey = "FAKEDATA"
       consumerSecret = "FAKEDATA"
       twitCred <- OAuthFactory$new(consumerKey=consumerKey,
                                    consumerSecret=consumerSecret,
                                    requestURL=reqURL,
                                    accessURL=accessURL,
                                    authURL=authURL)
       twitCred$handshake()
       registerTWitterOAuth(twitCred)

Run the code above in your browser using DataLab