This is Electron module that easily OAuth authenticates your Electron app with twitter.
npm install electron-oauth-twitter
-
You need Consumer Key (API Key) and Consumer Secret (API Secret).
-
Set Callback URL at settings of you app. If you do not set Callback URL, it will evoke PIN Based OAuth.
- Edit your Electron main file. See example. Dive into OAuth!
var dialog = require('electron').dialog;
var OauthTwitter = require('electron-oauth-twitter');
var twitter = new OauthTwitter({
key: '****',
secret: '****',
});
twitter.startRequest().then(function(result) {
var accessToken = result.oauth_access_token;
var accessTokenSecret = result.oauth_access_token_secret;
dialog.showErrorBox('Status', 'Token: ' + accessToken + '\nSecret: ' + accessTokenSecret);
}).catch(function(error) {
console.error(error, error.stack);
});
MIT licensed