Created
November 10, 2015 00:42
-
-
Save reportbase/c828f25a92afdf452ac8 to your computer and use it in GitHub Desktop.
bitly
This file contains hidden or 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
[0, clr.SUBHEADER, "Bitly User Info", function() | |
{ | |
var http = new XMLHttpRequest(); | |
http.open("GET", "https://api-ssl.bitly.com/v3/user/info?access_token=" + global.bitfly_access_token); | |
http.responseType = "json"; | |
http.onreadystatechange = function(){if (this.readyState == this.DONE) console.log(this.response);}; | |
http.send(); | |
}], | |
[0, clr.SUBHEADER, "Bitly Link Info", function() | |
{ | |
var http = new XMLHttpRequest(); | |
http.open("GET", "https://api-ssl.bitly.com/v3/link/info?access_token=" + global.bitfly_access_token + "&link=" + encodeURIComponent("http://bit.ly/reportbase") ); | |
http.responseType = "json"; | |
http.onreadystatechange = function(){if (this.readyState == this.DONE) console.log(this.response);}; | |
http.send(); | |
}], | |
[0, clr.SUBHEADER, "Bitly Link History", function() | |
{ | |
var http = new XMLHttpRequest(); | |
http.open("GET", "https://api-ssl.bitly.com/v3/user/link_history?access_token=" + global.bitfly_access_token); | |
http.responseType = "json"; | |
http.onreadystatechange = function(){if (this.readyState == this.DONE) console.log(this.response);}; | |
http.send(); | |
}], | |
[0, clr.SUBHEADER, "Bitly Login", function() | |
{ | |
window.open("https://bitly.com/oauth/authorize?client_id=" + global.bitly_client_id + | |
"&redirect_uri=http://bull.report/bitly.authorization","_self"); | |
}], | |
[0, clr.SUBHEADER, "Bitly Shorten", function() | |
{ | |
var http = new XMLHttpRequest(); | |
http.open("GET", "https://api-ssl.bitly.com/v3/shorten?access_token=" + global.bitfly_access_token + "&longUrl=" + encodeURIComponent(get_application_url())); | |
http.responseType = "json"; | |
http.onreadystatechange = function(){if (this.readyState == this.DONE) window.open("https://app.bitly.com","_self");}; | |
http.send(); | |
}], |
bitly_client_id: "8c4885b2f1ab5ff5086bb69cdbf7a1ec3ff34a4b",
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
app.get('/bitly.authorization', function(req, res)
{
var a = url.parse(req.url, true);
var query = a.query;
var code = query.code;
var postData = qs.stringify(
{
'client_id' : global.bitly_client_id,
"client_secret" : "920e04f480692621d53c785ee9ea89b27566ca11",
"code" : code,
"redirect_uri" : "http://bull.report/bitly.authorization"
});
})