twitter - How to send tweet from Google Chrome Extension? -


i following google oauth tutorial. , having trouble authorizing user.

i sending user twitter authorization. chrome extension , there no callback. dont know how send tweet on behalf of user. how doing things:

  1. i have background page has code of authorizing user twitter. on time when user install extension, background page send user twitter authorization. authorization method getting called call back. dont know if having make tweet.
  2. now when user click on extension icon, popup.html appear. , on page want user send tweet. how?

following code:

manifest.json

{ "name": "tweetchrome", "version": "1.0", "description": "tweet chrome", "browser_action": { "default_icon": "images/share.png",  "popup": "popup.html" }, "permissions": [  "tabs", "http://ajax.googleapis.com", "*://*.twitter.com/*",  "clipboardwrite" ], "options_page": "options.html", "background_page": "background.html"    } 

background.html getting html page markup in resp of callback method. dont know for?

var oauth = chromeexoauth.initbackgroundpage({                       'request_url': 'https://api.twitter.com/oauth/request_token',                       'authorize_url': 'https://api.twitter.com/oauth/authorize',                       'access_url': 'https://api.twitter.com/oauth/access_token',                       'consumer_key': 'key',                       'consumer_secret': 'secret',                       'scope': '',                       'app_name': 'tweetchrome'                     });                  oauth.authorize(onauthorized);                function onauthorized() {               var url = 'https://api.twitter.com/oauth/authorize';                            /*as optional, left empty*/               var request = {                 'force_login': '',                 'screen_name': ''               };               oauth.sendsignedrequest(url, callback, request);             };              function callback(resp, xhr) { alert('it called too'); }; 

popup.html tweet using borrowed twitter.js. didn't wrote it.

           twitter.verify_credentials({install: true});                   twitter.update("test"); 

my approach of oauth right on having in background page? authorization getting call how far make tweet user?

any appreciated. hopeful solve issue finish extension.

you don't need request https://api.twitter.com/oauth/authorize in onauthorized - once function, have key , user has authenticated.

try requesting http://api.twitter.com/1/account/verify_credentials.json in onauthorized instead. should see json response user's information.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -