How to instantiate a Box Nodejs SDK client with access to all files within an application
I am developing a box application that will be triggered from a file upload webhook. The application will then download the specified file, submit that file to azure for OCR, and then write the OCR'd text back to Box as metadata for full-text searching. I am having an issue with the permissions that seem to be in effect for box applications in the sense that I am met with 404 errors from attempting to access files that the managed user isn't a collaborator on. I would ideally like a client with access to every file within the application without having to explicitly add them to the parent folder as a collaborator. Is this possible? I have tried to do this with the service account by toggling application scope settings, but I have been unsuccessful. From there, as I mentioned above, I created a "user" client for the admin/managed user of the whole application, but I am still met with 404's unless I explicitly add them as a collaborator. I am trying to save the API call of explicitly adding the managed user as a collaborator when accessing a file, but I am at a loss. Can anyone clarify this? The application settings that I have set for the service account are pictured below.
-
Hi ,
Yes, that's possible. Here are two methods that I would suggest looking into:
- Skills application: Take a look at the Skills documentation, as this system is built to do pretty much what you're implementing. When a new file is uploaded to a location that is enabled for the Skill application it'll send a notification to an endpoint you designate. In the notification payload are a read and write token to allow you to read in the file content for the OCR system, then write metadata back on the file. It may provide a more streamlined way for you to build what you're intending.
- Global content manager scope: There are a few scopes that are enabled by request, including GCM. This scope will give your service account / app access to every files / folder in the enterprise by default, which should give you what you're looking for. You'll need to request that GCM be enabled for your enterprise through a support ticket.
Please let me know if you have any other questions.
Thanks,
Jon
Please sign in to leave a comment.
Comments
1 comment