user1355300
user1355300

Reputation: 4987

Twitter API 1.1 does not work?

According to the Twitter API 1.1 documentation, this should return data:

https://api.twitter.com/1.1/users/show.json?screen_name=rsarver 

But I keep getting

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

Am I doing something wrong?

Upvotes: 1

Views: 990

Answers (2)

user2482159
user2482159

Reputation: 21

You can use codebird js library for getting tweets. All you need is to create an app on twitter and note down the following :

1.Consumer Key
2.Consumer Secret Key
3.Access Token
4.Access Token Secret

Download codebird js Library from here : https://github.com/mynetx/codebird-js 

USAGE : 

 var cb = new Codebird;
    cb.setConsumerKey('YOURKEY', 'YOURSECRET');
    cb.setToken('YOURTOKEN', 'YOURTOKENSECRET');

    cb.__call(
    'oauth2_token',
    {},
    function (reply) {
        var bearer_token = reply.access_token;
    }
    );

    cb.__call(
        'search_tweets',
        {
            q : "your query which you want to search",
            from : twitter_user
        },
        function (data) 
        {
             console.log(data);
        },
        true // this parameter required
    );

Upvotes: 1

DWRoelands
DWRoelands

Reputation: 4940

As the Twitter API 1.1 documentation indicates, you need to be authenticated in order to access users/show.

Upvotes: 4

Related Questions