JWT - 404 As-User Call Fails When Making Enterprise API Calls
AnsweredSo this is related to previous thread but I can't seem to make an enterprise api call using JWT.
It seems like As-User calls fails even if it's configured to allow it.
BoxDeveloperEditionAPIConnection api = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(
ENTERPRISE_ID, CLIENT_ID, CLIENT_SECRET, encryptionPref, accessTokenCache);
Date beginDate = new Date(System.currentTimeMillis() - (1000 * 60 * 60 * 2));
Date endDate = new Date(System.currentTimeMillis());
// Get enterprise events with enterprise api and not user api
EventLog eventLog = EventLog.getEnterpriseEvents(api, beginDate, endDate);
while (eventLog.getSize() > 0) {
for (BoxEvent event : eventLog) {
if (event.getSourceJSON().get("item_id") != null) {
String itemId = event.getSourceJSON().get("item_id").asString();
String itemName = event.getSourceJSON().get("item_name").asString();
System.out.println("itemId: " + itemId);
System.out.println("itemName: " + itemName);
BoxFile boxFile = new BoxFile(api, itemId);
BoxFile.Info info = boxFile.getInfo();
}
}
}
Output:
itemName: downloads_dev08_advanced web dev with o365.pptx
com.box.sdk.BoxAPIException: The API returned an error code: 404
-
I found by working with support that As-User is not yet supported in the box-java-sdk:
https://github.com/box/box-java-sdk/issues/76
So that's why it's not working.
Please sign in to leave a comment.
Comments
1 comment