Skip to content

Instantly share code, notes, and snippets.

Last active March 30, 2021 11:26
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save baptx/ffb268758cd4731784e3 to your computer and use it in GitHub Desktop.
Access Twitter API 1.1 in web browser
/* Access Twitter API 1.1 in browser.
** Get your access keys to use Twitter API 1.1:
** Format JSON in Firefox:
** You can change Twitter API URL and Twitter screen_name, then execute script from a trusted web page without CSP protection like about:blank in Firefox Scratchpad or any other browser console.
var script = document.createElement("script");
script.setAttribute("src", ""); // (down)
script.addEventListener("load", function() {
var script2 = document.createElement("script");
script2.setAttribute("src", ""); //
script2.addEventListener("load", function() {
var url = "";
var accessor = {
token: "XXX",
tokenSecret: "XXX",
consumerKey : "XXX",
consumerSecret: "XXX"
var message = {
action: url,
method: "GET",
parameters: {screen_name: "jack"}
OAuth.completeRequest(message, accessor);
OAuth.SignatureMethod.sign(message, accessor);
document.location = url + '?' + OAuth.formEncode(message.parameters);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment