electron-authentication-hatena
TypeScript icon, indicating that this package has built-in type declarations

3.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i electron-authentication-hatena

Weekly Downloads

7

Version

3.0.1

License

MIT

Unpacked Size

20.8 kB

Total Files

11

Last publish

Collaborators

  • azu