I am new to using Twitter API. I am trying to get data from the filter endpoint:
https://stream.twitter.com/1.1/statuses/filter.json?
In my play application I have following code (using WS and Iteratee from Scala):
WS.url(twitterURL)
.sign(OAuthCalculator(play.api.libs.oauth.ConsumerKey("xxx","xxx"), play.api.libs.oauth.RequestToken("xxx","xxxx")))
.postAndRetrieveStream(postData) {
_ => postProcessResponseIte();
}
But for some reason I am getting 401 UnAuthorized response:
HTTP/1.1 401 Authorization Required
cache-control: must-revalidate,no-cache,no-store
connection: close
content-length: 267
content-type: text/html
date: Wed, 06 Jan 2016 22:50:50 GMT
server: tsa
www-authenticate: OAuth realm="Firehose"
x-connection-hash: 0ae753e0b97ca45c5a3dd4f1167600bf
<html>\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n<title>Error 401 Unauthorized</title>
</head>
<body>
<h2>HTTP ERROR: 401</h2>
<p>Problem accessing '/1.1/statuses/filter.json?'. Reason:
<pre> Unauthorized</pre>
</body>
</html>
I have checked my machine time and it seems to be matching with what is in the response. Not sure how can I get around this.
Any help is much helpful. Thanks in advance !!