GET Trends gives me code 401, could not authenticate you code 32


#1

I try to execute this GET
http://api.twitter.com/1.1/trends/place.json?id=1
with my signature that works for follow and unfollow, but fetching the global trends I can’t

what do i wrong?


#2

Can you share an example of your failed request?

Here’s an example of a successful one:

GET https://api.twitter.com/1.1/trends/place.json?id=1

Authorization header:
OAuth oauth_version=“1.0”, oauth_nonce=“XJUqy”, oauth_timestamp=“1355844850”, oauth_signature_method=“HMAC-SHA1”, oauth_consumer_key=“mbmuCGVFTGHZOo5zr5Sx5A”, oauth_token=“819797-L587qRErTHNXXr8kb0eSqj6uCO2xephn1c14RCfies”, oauth_signature=“AGreTp1orazi5tHVhM0n7ZaVSpE%3D”

Signature base string:
GET&https%3A%2F%2Fapi.twitter.com%2F1.1%2Ftrends%2Fplace.json&id%3D1%26oauth_consumer_key%3DmbmuCGVFTGHZOo5zr5Sx5A%26oauth_nonce%3DXJUqy%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1355844850%26oauth_token%3D819797-L587qRErTHNXXr8kb0eSqj6uCO2xephn1c14RCfies%26oauth_version%3D1.0

Response Headers
date: Tue, 18 Dec 2012 15:34:11 GMT
content-encoding: gzip
x-rate-limit-limit: 15
x-rate-limit-remaining: 14
status: 200 OK, 200 OK
x-access-level: read-write-directmessages
content-length: 410
pragma: no-cache
last-modified: Tue, 18 Dec 2012 15:34:11 GMT
server: tfe
x-frame-options: SAMEORIGIN
content-type: application/json;charset=utf-8
expires: Tue, 31 Mar 1981 05:00:00 GMT
cache-control: no-cache, no-store, must-revalidate, pre-check=0, post-check=0
x-rate-limit-reset: 1355845751
x-transaction: 33668a4674666fcc
version: HTTP/1.1

Response
[
{
“trends”: [
{
“name”: “#PeliculasFavoritas”,
“url”: “http://twitter.com/search?q=%23PeliculasFavoritas”,
“promoted_content”: null,
“query”: “%23PeliculasFavoritas”,
“events”: null
},
{
“name”: “#PreguntasSinRespuesta”,
“url”: “http://twitter.com/search?q=%23PreguntasSinRespuesta”,
“promoted_content”: null,
“query”: “%23PreguntasSinRespuesta”,
“events”: null
},
{
“name”: “#EuQueroDeNatal”,
“url”: “http://twitter.com/search?q=%23EuQueroDeNatal”,
“promoted_content”: null,
“query”: “%23EuQueroDeNatal”,
“events”: null
},
{
“name”: “#GladIMet”,
“url”: “http://twitter.com/search?q=%23GladIMet”,
“promoted_content”: null,
“query”: “%23GladIMet”,
“events”: null
},
{
“name”: “#TrocoPessoasFalsasPor”,
“url”: “http://twitter.com/search?q=%23TrocoPessoasFalsasPor”,
“promoted_content”: null,
“query”: “%23TrocoPessoasFalsasPor”,
“events”: null
},
{
“name”: “Happy Birthday Bridgit Mendler”,
“url”: “http://twitter.com/search?q=“Happy+Birthday+Bridgit+Mendler””,
“promoted_content”: null,
“query”: “%22Happy+Birthday+Bridgit+Mendler%22”,
“events”: null
},
{
“name”: “Tokio Hotel”,
“url”: “http://twitter.com/search?q=“Tokio+Hotel””,
“promoted_content”: null,
“query”: “%22Tokio+Hotel%22”,
“events”: null
},
{
“name”: “Beau”,
“url”: “http://twitter.com/search?q=Beau”,
“promoted_content”: null,
“query”: “Beau”,
“events”: null
},
{
“name”: “Christmas”,
“url”: “http://twitter.com/search?q=Christmas”,
“promoted_content”: null,
“query”: “Christmas”,
“events”: null
},
{
“name”: “Xmas”,
“url”: “http://twitter.com/search?q=Xmas”,
“promoted_content”: null,
“query”: “Xmas”,
“events”: null
}
],
“as_of”: “2012-12-18T15:34:11Z”,
“created_at”: “2012-12-18T15:25:25Z”,
“locations”: [
{
“name”: “Worldwide”,
“woeid”: 1
}
]
}
]


#3

I rewrite the code starting by zero without so much libraries and this is the debug (i hope is enough)
OAuth debug: Authorization Oauth
OAuth debug: oauth_consumer_key="uxhZEoKhaorUoAXw"
OAuth debug: oauth_nonce="08859cb8d12fb5896b86642545bb39d9f059115f"
OAuth debug: oauth_signature="fp44uDx3Qudx0XkclFvWO9Sugn8%3D"
OAuth debug: oauth_signature_method="HMAC-SHA1"
OAuth debug: oauth_timestamp="1356981571"
OAuth debug: oauth_token="310272177-9QZaa88T6MaIMQn5KSV7OJnHfW7PpCk"
OAuth debug: oauth_version="1.0"
OAuth debug:
OAuth debug: baseURL: POST https://api.twitter.com/1.1/statuses/update.json -header $header -query $requestBody
OAuth debug: header: Authorization {OAuth oauth_consumer_key=“uxhZEoKhIaorUoAXw”, oauth_nonce=“08859cb8d12fb5896b86642545bb39d9f059115f”, oauth_signature=“fp44uDx3Qudx0XkclFvWO9Sugn8%3D”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1356981571”, oauth_token=“310272177-9QZaa88T6MaIMQSV7OJnHfW7PpCk”, oauth_version=“1.0”}
OAuth debug: query: status=Maybe%20he%27ll%20finally%20find%20his%20keys.%20%23peterfalk&trim_user=true&include_entities=true
HTTP 401: “Could not authenticate you” (code 32: Your call could not be completed as dialed.)


#4

Nevermind. Was my fault. I were creating the signature using more parameters than neccessary.

It’s working now. Thanks & sorry.