Last active
July 3, 2019 05:41
-
-
Save zirinisp/43273d3643c7a62447cc07c11c1c2a18 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oauth_nonce = createGuid(); | |
var oauth_timestamp = (new Date().getTime()/1000).toFixed(); | |
var signBase = 'GET' + '&' + encodeURIComponent(requestURL) + '&' + | |
encodeURIComponent( complexQuery + '&oauth_consumer_key=' + CONSUMER_KEY + '&oauth_nonce=' + | |
oauth_nonce + '&oauth_signature_method=' + oauth_signature_method + '&oauth_timestamp=' + | |
oauth_timestamp + '&oauth_token=' + CONSUMER_KEY + '&oauth_version=' + oauth_version + '&page=' + pageNo); | |
var hSig = rsa.signString(signBase, hashAlg); | |
var oauth_signature = encodeURIComponent(hextob64(hSig)); | |
var authHeader = "OAuth oauth_token=\"" + CONSUMER_KEY + "\",oauth_nonce=\"" + oauth_nonce + | |
"\",oauth_consumer_key=\"" + CONSUMER_KEY + "\",oauth_signature_method=\"RSA-SHA1\",oauth_timestamp=\"" + | |
oauth_timestamp + "\",oauth_version=\"1.0\",oauth_signature=\"" + oauth_signature + "\""; | |
var headers = { "Authorization": authHeader, "Accept": "application/json"}; | |
var options = { 'muteHttpExceptions': true, "headers": headers}; | |
var response = UrlFetchApp.fetch(requestURL + '?' + complexQuery + '&page=' + pageNo, options); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment