Miss any of our Open RFC calls?Watch the recordings here! »

electron-oauth-twitter

1.2.0 • Public • Published

electron-oauth-twitter

This is Electron module that easily OAuth authenticates your Electron app with twitter.

Install

npm install electron-oauth-twitter

Diving into OAuth

  1. Register your app.

  2. You need Consumer Key (API Key) and Consumer Secret (API Secret).

  3. Set Callback URL at settings of you app. If you do not set Callback URL, it will evoke PIN Based OAuth.

  1. Edit your Electron main file. See example. Dive into OAuth!
const { app, dialog } = require('electron');
 
app.once('ready', () => {
  const OauthTwitter = require('electron-oauth-twitter'); // eslint-disable-line global-require
  const twitter = new OauthTwitter({
    key: '****',
    secret: '****',
  });
 
  const options = {
    force_login: true,
  };
 
  twitter
    .startRequest(options)
    .then((result) => {
      const accessToken = result.oauth_access_token;
      const accessTokenSecret = result.oauth_access_token_secret;
      dialog.showErrorBox(
        'Status',
        `Token: ${accessToken} \nSecret: ${accessTokenSecret}`,
      );
    })
    .catch((error) => {
      console.error(error, error.stack); // eslint-disable-line no-console
    });
});

MIT licensed

Install

npm i electron-oauth-twitter

DownloadsWeekly Downloads

8

Version

1.2.0

License

MIT

Unpacked Size

16.8 kB

Total Files

6

Last publish

Collaborators

  • avatar