21 March 2018

Box Enterprise Module

Box Integration

Most experienced Mendix developers know that Mendix supports out of the box uploading of files and images. To be able to share your files and images with other users in your application, you can build functionality in your Mendix application or make use of an existing Cloud storage that provides file-sharing like Box, Google drive or Drop Box. This can provides multiple advantages. In this blog I’m focusing on how to integrate Mendix Applications with Box. 

Box application

The first thing you need, is to access an existing Box environment or you can sign up for a Box developer account. Create a new Box app and select how your Mendix application will authenticate to the Box API. In our example we will use OAuth 2.0 with a Json Webtoken. For correct configuration of your Box app see: Configuring your Box application.

Generate a RSA keypair to sign and authenticate the JWT request made by your app. Export the JSON config file and import this JSON file into your Mendix app.

Above: example Json config file. In the figure below you see how a user is authenticated with Box. Source: Box.com

FlowFabric Box Enterprise module

At FlowFabric, we have created our own Box Enterprise module using the Box SDK. In this module you are able to import the Json config file and create an App user and get an access token to authenticate with your Box Application.

What is a Box app user ?

App Users are full-featured enterprise Box accounts that belong to your application, not a Box end-user. Unlike typical Box accounts, these accounts do not have an associated login and can only be accessed through the Content API by the controlling application and associated Box User ID. This new user model allows your application to take advantage of groups, permissions, collaborations, comments, tasks, and the many other features offered by the Box platform.

Create a app user in Box

Get an access token

When testing your Box integration locally please turn off Emulate Cloud security. This can be found in your project settings / configurations.

That’s it ! Now you can make use of the Box API. After creating an app user in Box, do not forget to give this user access to your Box folders.

In the Mendix app store the module Box Connector is available. In this module you will find examples on how to use the Box API.

The next step is to facilitate the choice of which Cloud storage file-share Box, Google Drive or Drop box you want to use in your Mendix application. Let’s build a Cloud File-share integration Module that does that for you!