addAppUser results in generic "403 Forbidden"
Hi Box Dev Support,
I'm attempting to use the box-node-sdk to link a express.js-based webapp of mine to Box storage. TL;DR: I'm calling "addAppUser" on an enterprise admin client and am getting a very generic error in response:
'Unexpected API Response [403 Forbidden | .07b951660ef8972dfccd83d51de18c69a]'
Unlike other 403's I see posted on this forum, there is no clarifying message after the closing bracket (e.g. "access_denied_insufficient_permissions").
Here are some details about the code that sets up the client and makes the request:
// box-admin-client.js
const BoxSDK = require('box-node-sdk');
const jsonConfig = require('./box-config.json');
const sdk = BoxSDK.getPreconfiguredInstance(jsonConfig);
module.exports = sdk.getAppAuthClient('enterprise');
// box-config.json (with some redactions by me)
{
"boxAppSettings": {
"clientID": "w89r1xwg3cvm2onnf41a7mb6nbwppz5a",
"clientSecret": REDACTED,
"appAuth": {
"publicKeyID": "lfn8cbq4",
"privateKey": REDACTED,
"passphrase": REDACTED
}
},
"enterpriseID": "867752160"
}
// app.js
...
const express = require("express");
const boxAdminClient = require('./box-admin-client');
const app = express();
...
app.post("/register", async (req, res) => {
...
const email = req.body.email;
const boxAppUser = await boxAdminClient.enterprise.addAppUser(email);
...
}
-
Update: I was able to reproduce my error using this skeleton app provided on Box's own GitHub (configured with my own Box App credentials, of course). This leads me to believe that the error is most likely to do with some setting on the Box Dev Console / Box Admin site and not with the specific implementation of my app. Are you (Box Devs) able to pull up my app's details on your side, given the publicKeyID and/or the enterpriseID I provided above?
-
I think I've resolved this. For anyone experiencing this issue, try "Reauthorizing on changes":https://developer.box.com/guides/authorization/custom-app-approval/#re-authorization-on-changes.
I had made some changes to the my app's configuration after its initial authorization (notably, I had enabled "Administrative Actions: Manage users") through the Developer Console, and apparently if you do that, you need to reauthorize.
投稿コメントは受け付けていません。
コメント
2件のコメント