OAuth Electron Twitter

OAuth Electron Twitter

logo

Use Twitter OAuth in a simple way inside your electron App.

Installation

add it to your elenctron project using npm command

npm install oauth-electron-twitter --save

Usage

add the require for ouath and twitter specific code from this package

var oauth = require('oauth-electron-twitter').oauth;
var twitter = require('oauth-electron-twitter').twitter;

declare a twitter object, and use it as parameter for the oauth in conjuntion with the electron window used to display the login. the login method return a promise with the result or the errror provided by the login pase.

var window = new BrowserWindow({webPreferences: {nodeIntegration: false}});
var info = new twitter("key","secret");
var auth = new oauth();
auth.login(info, window).then((result) => {
               console.log(result);
          }).catch((error) => {
               console.log(error);
          });;

the result of this promise is a json object similar to next one

{
    oauth_access_token: ***,
    oauth_access_token_secret: ***
}
logo: Award graphic by Freepik and Twitter graphic by Icomoon from Flaticon are licensed under CC BY 3.0. Made and modified with Logo Maker
Avatar
Code dreamer, Creator of random stuff & sharing wizard