Skip to main content

OAuth Electron Twitter


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


add it to your elenctron project using npm command

npm install oauth-electron-twitter --save


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) => {
}).catch((error) => {

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

oauth_access_token: ***,
oauth_access_token_secret: ***

Github Repo

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