Skip to content

Instantly share code, notes, and snippets.

@allenmichael
Last active December 13, 2017 21:36
Show Gist options
  • Save allenmichael/db81fda76af6df92e7e3e8ba22392cc6 to your computer and use it in GitHub Desktop.
Save allenmichael/db81fda76af6df92e7e3e8ba22392cc6 to your computer and use it in GitHub Desktop.
'use strict';
// Require the Box SDK and the fs module
const box = require('box-node-sdk');
const fs = require('fs');
let configFile = fs.readFileSync('config.json');
configFile = JSON.parse(configFile);
// Initialize the SDK with the Box configuration file and create a client that uses the Service Account.
let session = box.getPreconfiguredInstance(configFile);
// Replace with user ID
let userId = "";
session.getAppUserTokens(userId)
.then((accessTokenObject) => {
console.log(accessTokenObject);
console.log(accessTokenObject.accessToken);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment