Embed configuration widget to administrator panel
In the administrative area of your CMS there is a section with CMS configuration. Please add there some page with N1ED options. Despite all the configuration of N1ED stores in the cloud, users should have a chance to change it directly from the CMS control panel.
This widget will also provide a feature of changing the API key and receiving a token. Also if you have this page you can (if you wish) hide configuration from N1ED editor to avoid reconfiguring N1ED by its users.
There is the ready widget for that. On the CMS configuration page just add loading the script and its initialization. See PHP example:
<?php
$apiKey = getN1EDApiKeyFromDB(); // write your own function
$token = getN1EDTokenFromDB(); // write your own function
?>
<div id="cms-conf-placeholder"></div>
<script src='//n1ed.com/js/n1ed-cms-conf-3.js'></script>
<script>
window.attachN1EDCmsConf({
el: document.getElementById("cms-conf-placeholder"),
urlSetApiKeyAndToken: '/setApiKey.php', // your script you've done in previous steps
apiKey: <?php echo $apiKey ?>,
token: <?php echo $token ?>,
editorName: 'tinymce', // or 'ckeditor' if you use it as base editor
integration: 'your-cms-name', // your CMS name in lowercase, type once and do not change in future please
isCheckBoxN1EDEcoEnabledVisible: false,
checkBoxN1EDEcoEnabledTitle: null,
checkBoxN1EDEcoEnabledValue: null,
onN1EDEcoEnabledChange: function (value, onFinished) {},
onApiKeyChange: function (apiKey, token) {}
});
</script>
Check it
Create one more key from Dashboard. Go to the N1ED configuration page with the configuration widget and specify the new API key. The widget will ask you for a password from Dashboard (one time action). In case of success password check the N1ED cloud server will return a new token for the specified API key and your server will save it in DB. Check that all your CMS internal users now load N1ED with the new API key and all the preferences are available for them without typing a password.