Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter API 1.1不起作用?_Api_Twitter - Fatal编程技术网

Twitter API 1.1不起作用?

Twitter API 1.1不起作用?,api,twitter,Api,Twitter,根据Twitter API 1.1文档,这将返回以下数据: https://api.twitter.com/1.1/users/show.json?screen_name=rsarver 但我一直在 {"errors":[{"message":"Bad Authentication data","code":215}]} 我做错什么了吗?如图所示,您需要通过身份验证才能访问用户/节目。如图所示,您需要通过身份验证才能访问用户/节目 You can use codebird js libra

根据Twitter API 1.1文档,这将返回以下数据:

https://api.twitter.com/1.1/users/show.json?screen_name=rsarver 
但我一直在

{"errors":[{"message":"Bad Authentication data","code":215}]}
我做错什么了吗?

如图所示,您需要通过身份验证才能访问用户/节目。

如图所示,您需要通过身份验证才能访问用户/节目

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
    );