hoist-node-sdk

1.0.3 • Public • Published

hoist-node-sdk

Node.js SDK for Hoist

Installation

$ npm install @hoist/node-sdk

Quick Start

var Hoist = require('@hoist/node-sdk');

//Use your API key from the Dashboard of your application
Hoist.setApiKey("xxx-xxx");

Creating Connector Authorization

Hoist.getBounceURL({
  connector: 'xxx',    
  bucketKey: 'xxx', //optional 
  returnUrl: 'xxx'  //optional
}).then(function(url) {
  reply.redirect(url);
});

or

Hoist.getBounceURL({
  connector: 'xxx',    
  bucketKey: 'xxx', //optional 
  returnUrl: 'xxx'  //optional
}, function(err, url) {
  reply.redirect(url);
});

Use the connector key you set up in the portal.

  • If both the return URL and bucket key are set; the user will be authenticated, the token is stored against them, and the user is redirected to the return URL.

  • If the return URL isn't set and the bucket key is set; the user will see a success screen showing the logo of the service they're connecting to and a success message.

  • If the return URL is set and the bucket key isn't set; the token will be appended to the URL in the querystring of the return URL on redirect.

  • If neither the return URL or bucket key are set; the user will see a success screen with the logo of the service they're connecting to, and the token that needs to be stored.

Listening to events

Hoist.on("EVENTNAME", function(event) {
  //event.payload contains the payload associated with the event
});

Removing event listeners

Hoist.off("EVENTNAME", function() { });
Hoist.off("EVENTNAME");

If you specify the method to remove, any other listener under that event will be retained. If you only specify the eventname, al events with that name will be removed.

Raising events

Hoist.raise("EVENTNAME", {});

Readme

Keywords

none

Package Sidebar

Install

npm i hoist-node-sdk

Weekly Downloads

1

Version

1.0.3

License

ISC

Last publish

Collaborators

  • jamiewilson