Node.js SDK for Hoist
$ npm install @hoist/node-sdk
var Hoist = require('@hoist/node-sdk');
//Use your API key from the Dashboard of your application
Hoist.setApiKey("xxx-xxx");
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.
Hoist.on("EVENTNAME", function(event) {
//event.payload contains the payload associated with the event
});
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.
Hoist.raise("EVENTNAME", {});