Just wondering if anyone managed to get Box UI Elements (Content Explorer and Content Uploader) working in a community.
Below is a snippet of a Visualforce page:
<apex:page standardController="Registration__c" extensions="Registration_Box_Ext" standardStylesheets="false">
<apex:includeScript value="{! $Resource.polyfill }" />
<div class="container">div>
<script>
var contentExplorer = new Box.ContentExplorer();
var accessToken = "{!accesstoken}";
console.log('Access Token: ' + accessToken);
var folderid = "{!Registration__c.BoxFolderId__c }";
console.log('Folder ID: ' + folderid);
contentExplorer.show(folderid, accessToken, {
container: ".container"
});
</script>
apex:page>
Extension:
public with sharing class Registration_Box_Ext {
private final Registration__c rego;
public Registration_Box_Ext(ApexPages.StandardController stdController) {
this.rego = (Registration__c)stdController.getRecord();
}
public String getAccessToken() {
String enterpriseId = '';
String publicKeyId = '';
String privateKey = '';
String clientId = '';
String clientSecret = '';
BoxJwtEncryptionPreferences preferences = new BoxJwtEncryptionPreferences();
preferences.setPublicKeyId(publicKeyId);
preferences.setPrivateKey(privateKey);
BoxPlatformApiConnection api = BoxPlatformApiConnection.getAppEnterpriseConnection(enterpriseId, clientId, clientSecret, preferences);
return api.accessToken;
}
}