This forum is now read-only. Please use our new forums at

Introduction to Twitter's API Forum

View Course » View Exercise

1661 points
Submitted by
Son Phan
about 2 years ago

Twitter API Intro 1/5 401 Error

When I tried to run Twitter, it then showed this error: Oops, try again. The response code should be '200' but you received '401'. Double check the credentials you passed to the OAuth library.

1 vote


me too, anyone?

179 points
Submitted by
almost 2 years ago

1 Comment

D2ab9ab2ab880e0ce230394f9bc88cbc?s=140&d=retro Martin almost 2 years ago

Did you follow the steps here: "Visit and register a new application.

On the application settings page, click "Create my access token" to generate an access token and secret.

Copy the values for consumer key, consumer secret, access token, and access secret into the example."

Make sure you create your app on the Twitter api page and generate the key pairs. Hope this is of help as I got the same error with the default code shown on the page.

0 votes


Make sure the following code is on your page require "json". I encountered this issue even after confirming my consumer token and secret & access token and secret were correct, and notice that the require json line was not there even after resetting the code. strange.

1509 points
Submitted by
almost 2 years ago

0 votes


Another possibility is that you forgot to put " ",or instead you used ' ' .
this works: "axyuiyuixyue486",
this don't: 'axyuiyuixyue486'

Good Luck

50 points
Submitted by
Victor Augusto Souza de Oliveira
almost 2 years ago