I have an iron-ajax
element set up:
<iron-ajax
id="get-tweets"
url="http://api.twitter.com/1.1/search/tweets.json?q=nasa&result_type=popular"
handle-as="json"
on-response="handleResponse"
debounce-duration="300">
</iron-ajax>
And I'm trying to pass an authentication header to it for Twitter, but I can't figure out how. Twitter has an example request and I'm trying to figure out how to pass the header to the ajax request:
getTweets() {
const ajax = this.root.querySelector('#get-tweets');
ajax.headers = Object.assign(ajax.headers, `what do I put here?`
});
ajax.generateRequest();
},
I can't seem to figure out how to do it. Let's say I have the following:
Consumer API keys:
abc (API key)
def (API secret key)
Access token & access token secret:
gh-ijk (Access token)
lmn (Access token secret)
Read and write (Access level)
How do I pass this info to the iron-ajax
element so I can make the request?