I am currently in the process of developing an application that interacts with the Twitter API. I am facing a challenge when attempting to make an HTTP GET request with specific headers using Angular2.
It is worth noting that the curl requests below are successful, provided the correct keys are in place.
The implementation I have tried so far does not allow me to include the necessary headers, which has been my only setback.
If anyone has encountered this issue before and has any recommendations on how to overcome it, I would greatly appreciate your input.
Thank you in advance!
constructor(private _http: Http) {
}
getTwitterResponse() {
return this._http.get('https://api.twitter.com/1.1/statuses/home_timeline.json')
.map(res => res.text);
}
Curl Request Sample with Headers (with authentication keys removed)
curl --get 'https://api.twitter.com/1.1/statuses/home_timeline.json' --header 'Authorization: OAuth oauth_consumer_key="123456", oauth_nonce="123456", oauth_signature="f%123456%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1475158916", oauth_token="123456", oauth_version="1.0"' --verbose