electron-authentication-hatena
v3.0.1
Published
Hatena OAuth Window library.
Downloads
19
Readme
electron-authentication-hatena
This Electron library that help to login by OAuth for Hatena.
はてなサービス(はてなブックマークなど)のAPI利用に必要なOAuth認証を行うライブラリです。
- http://developer.hatena.ne.jp/ja/documents/auth/apis/oauth
Installation
npm install electron-authentication-hatena
Usage
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
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
License
MIT
Acknowledgement
- http://qiita.com/Quramy/items/fc79cad92bb287478076