New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error message when creating twitter token #75

Bluebell4090 opened this Issue Mar 29, 2017 · 5 comments


None yet
5 participants

Bluebell4090 commented Mar 29, 2017

Hi, I am getting the error "Error in init_oauth1.0(self$endpoint, self$app, permission = self$params$permission, :
Unauthorized (HTTP 401)." using the code suggested for rtweet.

This is the code I have used:




appname <- "ST4090Louise"
key <- "xxxxxx"
secret <- "xxxxxx"

twitter_token <- create_token(
app = appname,
consumer_key = key,
consumer_secret = secret)

Any help would be appreciated. I've spent hours googling already and tried a few things but nothing is working.

Thank you!


This comment has been minimized.

Btibert3 commented Apr 15, 2017

Check that your appname, key, and secret are correct and do not contain extra spaces or bad characters. I saw the same error that you noted above, but when copying/paste from the Twitter dashboard, I had an extra set of spaces on my key.


This comment has been minimized.

lwasser commented Apr 17, 2017

hey @Bluebell4090 i had the same error - the fix for me was to set my callback url to when setting up my API application in twitter. If you follow the library documentation they suggest to do that. worked for me. hope it works for you!

@mkearney mkearney closed this May 25, 2017


This comment has been minimized.

nujcharee commented Jun 6, 2017

Hi there, I have the same problem. I believe my api key and secret are right as I tested in using library twitterR function setup_twitter_oauth(api_key,api_secret,access_token,access_token_secret) and that seemed tow ork but when I follow create_token function as per the above it keeps saying Unauthorized(401)


This comment has been minimized.


mkearney commented Jun 6, 2017

If the callback is correct, some users have reported copying an extra space on accident. Which version of rtweet are you using? There have been some recent bug fixes as well, if you want to try the Github version.

@mkearney mkearney reopened this Jun 6, 2017


This comment has been minimized.

nujcharee commented Jun 7, 2017

It's the latest version (I installed it off cran last night)
Will check extra space thank you v much.

@mkearney mkearney closed this Jul 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment