[R-pkg-devel] Help with making a package for Twitter Authentication
tushar.sadhu08 at gmail.com
Sun Dec 6 20:44:50 CET 2015
Really sorry for the late reply. So I read and read up as all the answers
suggested and here is my response to all of them but before that, I want
to establish what I am trying to achieve:
The aim is to get a Twitter App that displays n number of tweets about a
particular #tag but the main constraint is that it HAS to be put on version
control. Now the issue is this cannot happen without my personal account
being involved and the consumer token and keys along with the app specific
tokens being put up there.
One easy solution will be to create a twitter account for my project called
APPada (thereby removing my personal account from the picture) and then let
its keys out in the open as it wont harm anyone. Is this advisable?
But I want to know if there is a way to not include accounts at all.
As someone said bulk reading
Now to the individual responses :
I have infact followed the exact way you mentioned but have you tried using
your app for the last few months? They changed their policy of verification
and so there is a extra input value that I have to provide for accessing
After a lot of StackOverflow-ing and experimenting I found the solution to
get it work like the old times
requestURL <- "https://api.twitter.com/oauth/request_token"
accessURL <- "https://api.twitter.com/oauth/access_token"
authURL <- "https://api.twitter.com/oauth/authorize"
twitCred <- OAuthFactory$new(consumerKey=consumer_key,
twitCred$handshake(cainfo = system.file("CurlSSL", "cacert.pem", package
save(twitCred, file="twitter authentication.Rdata")
consumer_key = twitCred$consumerKey
consumer_secret = twitCred$consumerSecret
access_token = twitCred$oauthKey
access_secret = twitCred$oauthSecret
setup_twitter_oauth(consumer_key, consumer_secret, access_token,
Once this done, I have to manually enter the PIN dispplayed in the webpage
I ma directed to. Then everything works fine.
So the package I made had a function called AppadaInit() which did all this
and yet it required the PIN.
Another requirement is that my account has to be logged into everytime this
package is used. (Please find the screenshots attached which show these
Therefore it cannot be used for a project where I want people download it
and to use this.
The above method does use twitteR and the problem is that with the old
commands its functionalities (oauth_app) give the following message
OAuth authentication error:
This most likely means that you have incorrectly called
And that is the reason I went ahead with the only way which works, ie
entering the PIN everytime
Thanks for the forum link I will check for a solution there. But I did not
understand what you meant by this :
"But it feels like package authors are overly conservative about building in
default apps that can facilitate first-time or casual use of an API from R."
I have never used a Cronjob. Not sure how they work.Is it needed for a
Sorry for the long message, kindly do reply
Finally, thanks a lot for the replies so far guys!
On Wed, Nov 25, 2015 at 8:32 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
> I just use and external program: bti  and let it handle authentication
> (there is a set up step). That works beautifully for two cronjobs:
> CRANberries  (which has tweeted thousands of times) and the CRAN Repo
> Policy changes watcher  which tweets whenever the policy document is
> updated. I use bti because the R twitter clients were at the times shutout
> from twitter, and I also had a devil of a time making them work. I never
> looked back.
> That said, I have not attempted to read in bulk.
> Hth, Dirk
>  By Linux kernel maintainer Greg Kroah-Hartman, see
>  http://dirk.eddelbuettel.com/cranberries/
>  https://github.com/eddelbuettel/crp
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
[[alternative HTML version deleted]]
More information about the R-package-devel