49

Today, we discovered one of my clients Twitter feeds became broken.

I have tried switching to using the new API 1.1, but get the following error:

{"errors":[{"message":"Bad Authentication data","code":215}]}

Even using their own example generates the same response:

https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=2

I am referencing the following documentation.

https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline

Any idea what's up with this?

Thanks, Mikey

Michael Giovanni Pumo
  • 14,338
  • 18
  • 91
  • 140
  • Follow this link https://stackoverflow.com/questions/54807221/get-twitter-friends-list/54838712#54838712 – Naresh Feb 23 '19 at 06:25

2 Answers2

49

So, it seems Twitter's latest API 1.1 does not allow access without authentication - even for data that is seemingly public...like the latest 3 tweets from a timeline.

The best article I have found on this (which gives a great solution) for read-access can be found here:

http://www.webdevdoor.com/php/authenticating-twitter-feed-timeline-oauth/

I have followed the steps in the article above and can confirm it works great.

An interesting point to note, is that now, because you have to use access tokens and secret keys; all requests must be made with a server-side script. Prior to this I was using jQuery to make an AJAX request on Twitters JSON API directly. Now, you must AJAX request a dynamic script on your own website, if you wish to go down a Javascript route.

Michael Giovanni Pumo
  • 14,338
  • 18
  • 91
  • 140
  • can I get a .json since front-end using jquery or angular.js for example? https://stackoverflow.com/questions/44446255/get-web-service-from-api-twitter-1-1 – yavg Jun 13 '17 at 15:19
8

Your example doesn't state whether you are authenticating, so I will assume you are not.

All methods in API 1.1 require authentication via OAuth. https://developer.twitter.com/en/docs/basics/authentication/oauth-1-0a

Unauthenticated access is discontinued permanently.

Aman Ullah
  • 49
  • 7
Tim
  • 8,036
  • 2
  • 36
  • 52
  • 1
    I simply want to pull in the latest 3 tweets to the page; retrieving only information that's already public. This was fine before, but now requires authentication? There is / will be, no user process to this. It's just a simple "latest tweets" box. – Michael Giovanni Pumo Jun 17 '13 at 09:22
  • 2
    Yep. Same problem for thousands of others with broken apps. They dislike tweets being displayed by third parties and want to force you into using their official [embedded timelines](https://dev.twitter.com/docs/embedded-timelines). – Tim Jun 17 '13 at 09:26
  • 1
    Sorry, Page doesn't exists. – Pratik Butani Nov 07 '17 at 12:11
  • you could look at https://www.dataneb.com/post/how-to-make-calls-to-twitter-apis-using-postman-client to make a request using OAuth1.0 with the following – Nwawel A Iroume Feb 22 '20 at 19:41