box-java-sdk -- BoxUser.getAllEnterpriseUsers() returned an error code: 403
I'm using enterprise_id and enterprise token to generate an AppUser. I use that AppUser user_id, and client_id, client_secret to obtain the BoxDeveloperEditionAPIConnection api object. If I call the BoxUser.getCurrentUser(api) method, it returns me the information about the current AppUser. However, if I call the BoxUser.getAllEnterpriseUsers(api), it returns me an Iterable users object, but I can't enumerate this users object. Once I enumerate the users object, it throws me an exception - The API returned an error code: 403
I noticed this thread post on your community site - https://community.box.com/t5/Developer-Forum/Getting-403-error-while-BOX-API-call-to-get-the-root-folder/td-p/5527. Box Employee's Paul said the following in Oct-**removed**:
Currently, the enterprise token itself does not own any content, only individual App Users will own content, which is why you are seeing a 403 error. You can use the enterprise token for general management of your enterprise, such as creating and managing users, but content itself should be accessed using a token from a user sub type.
My question is can an AppUser (a.k.a. Service Account) call the BoxUser.getAllEnterpriseUsers(api) and returns me a list of enterprise users today in Jan 2017? It seems to me that this method is still not working.
Thanks,
Bobby
-
I would like to add additional information. As I debug your box-java-sdk code and found it failed when making the HTTP-GET call on https://api.box.com/2.0/users?limit=1000&offset=0. The response JSON is :
{"type":"error","status":403,"code":"access_denied_insufficient_permissions","help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Access denied - insufficient permission","request_id":"***number removed for privacy***5882ceb252caa"}
I'm using AppUser created by the enterprise token. why does this Service Account user do not have sufficient permission?
-
I use the enterprise token to getAllEnterpriseUsers() and it seems to work.
Please sign in to leave a comment.
Comments
2 comments