Last active
December 13, 2017 21:36
-
-
Save allenmichael/db81fda76af6df92e7e3e8ba22392cc6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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