Box
Use the OAuth authentication standard to connect to Box. You can authenticate with a user account or with a service account. A service account is required to grant organization-wide access scopes to the provider. The provider facilitates these authentication flows as described below.
1 Authenticate with a User Account
Note: Set the AuthScheme to OAuth to authenticate with this method.
Log in to your Box developers dashboard and click Create New App. Select your app type (e.g., Custom App).
Select the Standard OAuth 2.0 (User Authentication) authentication method and click View Your App. (After creating your app, you can click Configuration from the main menu to access your app settings.)
Set the Redirect URI to http://localhost:33333 or a different port number of your choice. When you connect you will need to set the CallbackURL connection property to this exact URL.
The OAuthClientId and OAuthClientSecret are also displayed in the same page.
Select the scope of user permissions your app will request.
2 Authenticate with a Service Account
Note: Set the AuthScheme to OAuthJWT to authenticate with this method.
Service accounts have silent authentication, without user authentication in the browser. You can also use a service account to delegate enterprise-wide access scopes to the provider.
Follow the steps below to create an OAuth application and generate a private key. You will then authorize the service account.
Log in to your Box developers dashboard and click Create New App. Select your app type (e.g., Custom App).
Select the OAuth 2.0 with JWT (Server Authentication) authentication method and click View Your App. (After creating your app, you can click Configuration from the main menu to access your app settings.)
Select the application access level and the scope of user permissions your app will request. The enterprise access level enables you to work with existing users in your enterprise. The application-level setting restricts access to App-type users, users that have only API access.
Generate your RSA keypair. First you need to generate your private key. You can do this by running the following OpenSSL command : "openssl genrsa -aes128 -out private_key.pem 2048" (you can install and use the Cygwin package to run the OpenSSL RSA keypair if you are using Windows).
Generate your public key by running the following OpenSSL command: "openssl rsa -pubout -in private_key.pem -out public_key.pem". Copy the contents of the generated public_key.pem file and then add it by using the Add and Manage Public Keys option in your app settings.
6. Authorize the application in the enterprise admin console: Click Apps -> Custom Applications -> Authorize New App and enter the Client Id in your app settings.
Note: If you change the JWT access scopes, you will need to reauthorize the application in the enterprise admin console: Click Apps in the main menu and then select the ellipsis button next to your JWT application name. Select Reauthorize App in the menu.
After setting the following connection properties, you are ready to connect:
InitiateOAuth: Set to GETANDREFRESH.
OAuthClientId: Set to the Client Id in your app settings.
OAuthClientSecret: Set to the Client Secret in your app settings.
OAuthJWTCertType: Set to "PEMKEY_FILE".
OAuthJWTCert: Set to the path to the .pem file you generated.
OAuthJWTCertPassword: Set to the password of the .pem file.
OAuthJWTCertSubject: Set to "*" to pick the first certificate in the certificate store.
OAuthJWTSubjectType: Set to "enterprise" or "user" depending on the Application Access Value you selected in your app settings. The default value of this connection property is "enterprise".
OAuthJWTSubject: Set to your enterprise Id if your subject type is set to "enterprise" or your app user Id if your subject type is set to "user".
OAuthJWTPublicKeyId: Set to the Id of your public key in your app settings.
When you connect the provider completes the OAuth flow for a service account.
Creates and signs the JWT with the claim set required by the provider.
Exchanges the JWT for the access token.
Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
Submits the JWT for a new access token when the token expires.
The following are the connection properties for Box. Not all properties are required. Enter only property values pertaining to your installation. Several properties will be automatically initialized with the appRules defaults.
Last updated