Confusion about creating an App User with the box-node-sdk

New post



  • kendomen

    It was confusing to me too.


    So basically, I did this:

    1.  Steps 1-3 of

    2.  I didn't try to create the jwt assertion manually - I used the sdk. 

    3.  Then I ran the app:


    Comment actions Permalink
  • Box Product Support

    I solved it directly through box-node-sdk. While there is no "add app user" api call (e.g. like client.users.add), they do provide generic calls. So I used it like this:

 '/users', {body: {name: "App User Name", "is_platform_access_only": true}}, function(err, response) {

    if (!err) {
    console.log("User create:");
    } else {
    console.log("Error creating user");


    I authenticated like this:


    var sdk = new BoxSDK({
    clientID: 'CLIENT_ID',
    clientSecret: 'CLIENT_SECRET',
    appAuth: {
    keyID: 'KEY_ID',
    privateKey: 'PRIVATE_KEY',
    passphrase: 'PRIVATE_PASS'

    client = sdk.getAppAuthClient('enterprise', 'ENTERPRISE_ID');

     CLIENT_ID, CLIENT_SECRET and ENTERPRISE_ID from the Box portal, while KEY_ID, PRIVATE_KEY and PRIVATE_PASS is from creating the RSA keypair. PRIVATE_KEY is the whole .pem file and KEY_ID is from the Box-portal.

    Comment actions Permalink
  • exnerr

    Thank you so much! This did the trick.


    Something to keep in mind: The setting for "Application Access" needs to be set to 'Enterprise' for this to work.  If you change the setting, you'll need to re-authorize the App in your enterprise.

    Comment actions Permalink
  • kukkapilla

    How can we do this with JWT without SDK? switch to another user , any sample code will be appreciated.

    Comment actions Permalink

Please sign in to leave a comment.