You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
oath 1.0 component for chrome extension, using ohauth
Handles the user authorization stage by opening a new tab, and then closing it. It does it by redirecting to a local callback-page.html after the user authorization, then the extension closes the tab and resumes the oauth process.
// We need to specify where the component is relative to the root// so the extension can find callback-page.htmlvarOAuth=require('chrome-oauth')('components/tomerdmnt-chrome-oauth/');// OAuth optionsvaropts={"requestTokenUrl": "https://api.dropbox.com/1/oauth/request_token","authorizeUrl": "https://www.dropbox.com/1/oauth/authorize","accessTokenUrl": "https://api.dropbox.com/1/oauth/access_token","consumerKey": "your_consumer_key","consumerSecret": "your_cosumer_secret"};// All steps of the authorization with this lineOAuth.authorize(opts,function(err,o){if(err)thrownewError(err);// prepare a request objectvarreq={url: 'https://...'method: 'POST',data: {data: 'data'},qs: {a: 'b'},headers: {'Content-Type': 'application/json'}};// send a requesto.send(req,function(xhr){// do something});// it also works with a regular parmeters// o.send('GET', 'https://..', qs, data, headers, cb);});
Installation
$ component install tomerdmnt/oauth
API
Check out index.js
About
oath 1.0 component for chrome extension, using ohauth