Skip to content Skip to sidebar Skip to footer

Is It Possible To Use Nodejs Modules Like "oauth" In My Firefox Addon?

This is the first time I'm writing a Firefox addon. For the addon I'm trying to write, I need to make calls to Twitter's APIs. In order to do so, I need an oauth library to start o

Solution 1:

It depends on the module, but it often is possible. The Browserify makes it easy to convert node modules for use in the browser.

Solution 2:

You can but you have to browserify and polyfill everything. And there is no documentation. You should browse some github repos to see how others devs are doing it.

On NPM, there are few modules designed for Firefox addons, they are tagged jetpack. There is one for Google OAuth, it may help if you need to write your own module.

Solution 3:

Fully working Twitter OAuth sign in, using JPM addon sdk:

https://github.com/Noitidart/jpmOAuth/

The dependencies that were needed were the CryptoJS files for the SHA1-HAMC encryption.

Install that addon. It will work perfectly.

When customizing for yourself, you will have to update the global variable gOauth.twitter entries of callback, key, and secret. You get this from the manage app on twitter:

The details page, this is where you get the key and callback - for me the url is - https://apps.twitter.com/app/12197899

Then from the "Keys and Access Tokens" page you get the secret - for me the url is - https://apps.twitter.com/app/12197899/keys

Post a Comment for "Is It Possible To Use Nodejs Modules Like "oauth" In My Firefox Addon?"