Twitter API 1.1无法对您2进行身份验证

Twitter API 1.1 Could not authenticate you 2

本文关键字:身份验证 API Twitter      更新时间:2023-09-26

我正在尝试从这个查询中获取结果。

https://api.twitter.com/1.1/search/tweets.json?q=?&geocode=39.893280,32.779655,5km&count=100

我收到code:32 Could not authenticate you错误。我正在使用解析云代码。

Parse.Cloud.httpRequest({
    method: 'GET',
    url: urlLink,
    headers: {
        "Content-Type": "application/x-www-form-urlencoded",
        "Authorization" : 'OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"'
    },
    body: {
    },
    success: function(httpResponse) {
        // console.log(httpResponse.text);
        response.success(httpResponse.text);
    },
    error: function(httpResponse) {
        response.error('Request failed with response ' + httpResponse.status + ' , ' + JSON.stringify(httpResponse));
    }
});

我从这里创造了一切。所以钥匙和签名是正确的。可能我提供的urlLink格式错误,但我检查了几次。这里怎么了?

这是正确工作的curl代码。换行只是为了更好的可读性。

curl --get 'https://api.twitter.com/1.1/search/tweets.json' 
--data 'count=100&geocode=39.893280%2C32.779655%2C5km&q=%3F' 
--header 'Authorization: OAuth oauth_consumer_key="hKHVs8mDhW1rvZaPSLV9NywDS", oauth_nonce="5930fc59da48a2b30a5ff90939184b82", oauth_signature=somethingcorrect, oauth_signature_method="HMAC-SHA1", oauth_timestamp="1427745599", oauth_token="2900478017-RUQFnvSL7Vh1WohOBLbkswx55vtcgbnaexNt6ed", oauth_version="1.0"' --verbose

问题不是?,而是我应该写%3F

这是查询的最新版本

https://api.twitter.com/1.1/search/tweets.json?q=%3F&geocode=39.893280,32.779655,5km&count=100

文件:https://dev.twitter.com/rest/reference/get/search/tweets

q: UTF-8、URL编码的搜索查询,最多500个字符,包括运算符