Statuses/filter => HTTP/1.1 401 Authorization Required

streaming
statuses-filter

#1

Hi!

I have been trying for days to implement a client for the Twitter statuses/filter API.

I can’t use an existing library because what I am trying to do is exactly to create a very simple library on InterSystems technology that don’t rely on PHP, Python, or any other technology.

I have a developer account with twitter with an app created and I have my consumer keys and secret as well as my access key and secret.

Here is how my HTTP looks like and what I am getting back:

POST /1.1/statuses/filter.json HTTP/1.1
Host: stream.twitter.com
Content-Type: application/x-www-form-urlencoded
Connection: keep-alive
Accept: application/json
User-Agent: IRIS Twitter Streaming Demo Adapter 1.0
Authorization: OAuth oauth_consumer_key=“HTU8ULyS5TW7CuPr3i0ymBnTp”, oauth_token=“15843319-cxj7pEpTY2DqqUQdsprkMpPpH1jS4NX7KpFooAYhR”, oauth_signature_method=“HMAC-SHA1”, oauth_signature=“iuf8CIAR-bhFbrJr594CP0sxN3k”, oauth_timestamp=“1546282597”, oauth_nonce=“mhVv86cUJfwdsAnIQWrOOA”, oauth_version=“1.0”
Content-Length: 251

follow=@amirsamary&language=en&oauth_consumer_key=HTU8ULyS5TW7CuPr3i0ymBnTp&oauth_nonce=mhVv86cUJfwdsAnIQWrOOA&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1546282597&oauth_token=15843319-cxj7pEpTY2DqqUQdsprkMpPpH1jS4NX7KpFooAYhR&oauth_version=1.0

HTTP/1.1 401 Authorization Required

\n\n\nError 401 Unauthorized

HTTP ERROR: 401

Problem accessing '/1.1/statuses/filter.json'. Reason:

    Unauthorized

#2

Hi @amirsamary - you could try running this request with Insomnia, as this might help you understand where the error lies.

Also, please review our documentation on authorising a request here: https://developer.twitter.com/en/docs/basics/authentication/guides/authorizing-a-request

Note that the example in our documentation has Accept: */* rather than Accept: application/json. Although I don’t think this is causing the issue as such, it might be worth changing this parameter when you send the HTTP request.


#3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.