Created
September 15, 2017 09:40
-
-
Save allenmichael/7f4e613d266a9549749d0ce53963447a to your computer and use it in GitHub Desktop.
Authenticate to Box with a Service Account and create a new App User
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'; | |
| let BoxService = require('./boxClientService'); | |
| let Box = require('box-node-sdk'); | |
| const fs = require('fs'); | |
| let configFile = fs.readFileSync('config.json'); | |
| configFile = JSON.parse(configFile); | |
| let BoxInstance = Box.getPreconfiguredInstance(configFile); | |
| let serviceAccount = BoxInstance.getAppAuthClient('enterprise'); | |
| serviceAccount.enterprise.addAppUser('test appuser', null, function (err, user) { | |
| if (err) { | |
| console.log(err); | |
| return; | |
| } | |
| console.log(user); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment