twinstage-client
v0.1.4
Published
twinstage npm for client side frameworks
Downloads
3
Readme
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();
}