Alex RKA
Alex RKA

Reputation: 23

twitteR package for R authentication: error 401

Hy everyone/anyone and thank you for considering it! I'm stuck at the final stage of twitteR package authentication. After a successful cred$handshake as I'm trying to end up the authentication with setup_twitter_oauth, the program keeps throwing the following message:

Error in init_oauth1.0(self$endpoint, self$app, permission = 
self$params$permission) : client error: (401) Unauthorized

Any idea what this could be and how could I get around it?

Upvotes: 2

Views: 7605

Answers (1)

Ray Li
Ray Li

Reputation: 2331

Not sure the precise source of your error, and I had used this package about 2 months ago. I ran into errors doing the handshake as well.

To work-around, I avoided the explicit handshake by using setup_twitter_oauth directly.

consumerKey <- "[your Twitter consumer key]"
consumerSecret <- "[your Twitter consumer secret]"
accessToken <- "[your Twitter access token]"
accessTokenSecret <- "[your Twitter access token secret]"

setup_twitter_oauth(consumerKey, consumerSecret, accessToken, accessTokenSecret)

This seemed to work for me. The various OAuth parameters come from Twitter. I wrote up how to do that here: Newborn app using Twitter and R.

The complete R source code is on BitBucket (the stuff at the bottom is probably most relevant): newborn-app.R.

Upvotes: 6

Related Questions