npm.io
0.1.4 • Published 8 years ago

twinstage-client

Licence
ISC
Version
0.1.4
Deps
1
Vulns
0
Weekly
0

twinstage-client

twinstage npm package for client side frameworks

Usage

const ClientCredentialsProcess = require('twinstage-client').ClientCredentialsProcess;

let options = {
  authorization_url: env.TWINSTAGE_AUTHORIZATION_URL,
  client_id: env.TWINSTAGE_CLIENT_ID,
  client_secret: env.TWINSTAGE_CLIENT_SECRET,
  fetch_interval: 600   // every 10 minutes
};

async function main() {
  // create an instance of ClientCredentialsProcess and start
  // the background process
  let process = new ClientCredentialsProcess(options);
  process.start();

  // the access token would be available as a promise and can be requested as often as needed
  let accessToken = await process.waitToken();
}