Electron library: Help to login by OAuth for Hatena
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
src
test
.gitignore
.travis.yml
LICENSE
README.md
package.json
tsconfig.json
yarn.lock

README.md

electron-authentication-hatena Build Status

This Electron library that help to login by OAuth for Hatena.

はてなサービス(はてなブックマークなど)のAPI利用に必要なOAuth認証を行うライブラリです。

Installation

npm install electron-authentication-hatena

Usage

screenshot

See example app.

npm run example

Code:

const electron = require('electron');
const dialog = electron.dialog;

const CONSUMER = {
    key: '______',
    secret: '_______'
};
const AuthenticationHatena = require("electron-authentication-hatena").AuthenticationHatena;
// http://developer.hatena.com/ja/documents/auth/apis/oauth/consumer
const hatena = new AuthenticationHatena({
    key: CONSUMER.key,
    secret: CONSUMER.secret,
    scopes: ["read_public", "write_public"]
});
hatena.startRequest().then(function (result) {
    var accessToken = result.accessToken;
    var accessTokenSecret = result.accessTokenSecret;
    dialog.showErrorBox("Status", "Token: " + accessToken + "\nSecret: " + accessTokenSecret);
    console.log(accessToken, accessTokenSecret);
}).catch(function (error) {
    console.error(error, error.stack);
});

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

Acknowledgement